An amazing alternative to Python's builtin timeit module that allows for high resolution timing of functions as well as in-depth line-by-line timing. It also exposes convenient classes to measure execution time for any arbitrary code.
Project description
wraptimer
An amazing alternative to Python's builtin timeit module that allows for high resolution timing of functions as well as in-depth line-by-line timing. It also exposes convenient classes to measure execution time for any arbitrary code.
Sync function example
# imports
import time
from wraptimer import TimeIt
# Init
timeit = TimeIt()
# decorate
@timeit.byline
def test_by_line():
a = 10
b = 20
time.sleep(0.8)
c = a + b
return [a, b, c]
# run
test_by_line()
Async function example
# Imports
import asyncio
from wraptimer import TimeIt
# Init
timeit = TimeIt()
# decorate
@timeit.byline
async def test_by_line_async():
a = 10
b = 20
await asyncio.sleep(1.25)
return [a, b]
# run
asyncio.run(test_by_line_async())
Don't need Line-by-line tracing?
Use @timeit.func if you do not want to print line-by-line durations.
...
@timeit.func
async def test_by_line_async():
a = 10
b = 20
await asyncio.sleep(1.25)
return [a, b]
Read the documentation
For more about wraptimer, Read The Documentation
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file wraptimer-0.1.2.tar.gz.
File metadata
- Download URL: wraptimer-0.1.2.tar.gz
- Upload date:
- Size: 5.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
678b4f0048675aa5bc7aa589ca174f216d930872b657148584e75e6bdc010af2
|
|
| MD5 |
ac5d6e1ebb8838c7fbc19babd350bca4
|
|
| BLAKE2b-256 |
72c4ad8bd17174fccdc51a9eef6dc6d944ed535cc5be251148089d49b84c00c9
|
File details
Details for the file wraptimer-0.1.2-py3-none-any.whl.
File metadata
- Download URL: wraptimer-0.1.2-py3-none-any.whl
- Upload date:
- Size: 6.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dc07867e8deb791ad92814fb275a199d22932941b7f14b3721f52a9d58db8efa
|
|
| MD5 |
edd9c054fd3e77a405587fe7700484d2
|
|
| BLAKE2b-256 |
2a205cb3d57249437326b743d130dd3fc7c47d91e1b4c74f68e27eae188ad50c
|