Conveniently get a rough idea of how long things take.
Project description
magic-timer
pip install magic-timer
Conveniently get a rough idea of how long things take.
This is a light wrapper around the standard library's time.monotonic.
How to use:
Use via MagicTimer
object:
from magic_timer import MagicTimer
def do_stuff():
[i*i for i in range(5_000_000)]
timer = MagicTimer()
do_stuff()
print('Stuff took', timer)
> Stuff took 455 milliseconds
Use via ftimer
decorator:
from magic_timer import ftimer
@ftimer
def do_stuff():
[i*i for i in range(20_000_000)]
do_stuff()
> `do_stuff` ran in 1.9 seconds.
The use case for this package:
You have something you want to time, but you don't want to time it multiple times with timeit.
You also don't want to use Jupyter's %%timeit
because it puts the cell into a different scope.
You can import magic-timer
, throw it in, and get a rough idea of the time taken. (It's slightly neater than using time.monotonic directly.)
Project details
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
File details
Details for the file magic-timer-0.1.1.tar.gz
.
File metadata
- Download URL: magic-timer-0.1.1.tar.gz
- Upload date:
- Size: 2.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.1.post20200323 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 42144dcfd58c6133bc4976ed56d0e023054d227fceb0dd3d345baa74a60c4bc9 |
|
MD5 | 4f4f7d363a0c9d35682b53364f959dd1 |
|
BLAKE2b-256 | 839d123d64305149dd7712adf50dbd1499ef2ac99beb99f6898e4de77ea6b787 |
File details
Details for the file magic_timer-0.1.1-py2-none-any.whl
.
File metadata
- Download URL: magic_timer-0.1.1-py2-none-any.whl
- Upload date:
- Size: 4.3 kB
- Tags: Python 2
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.1.post20200323 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1afc4fe9e775c8976fb03775ee4faf014d52fafb4570818fb15080e432e0d7f3 |
|
MD5 | ce90b5f0a0529fb38dd5c224cc302fd0 |
|
BLAKE2b-256 | 49f7b8720207fb776569116aad505473f9ad1785fcf1955893c481db4cad48d5 |