The simplest way to time a block of code.
Project description
ez-timer
The easiest way to time a code block in Python.
Quick Links:
Overview
ez-timer provides a single, easy to use API for timing function calls.
with ez_timer() as timer:
1 + 1
timer.result
# 0.000001
That is it. That is the API. Solves one problem, and solves it well.
Background
When working on extensive profiling for an enterprise Python project I regularly found myself writing:
start = time.time()
# some code
end = time.time()
result = end - start
# do something with result
While timeit exists, I found timeit to be heavy handed for what I needed in 90% of cases.
This inspired me to create ez-timer.
Installation
ez-timer can be installed from pypi:
pip install ez-timer
Usage
Using ez-timer is simple:
from ez_timer import ez_timer
with ez_timer() as timer:
# run expensive computation
time.sleep(1)
print(timer.result)
# > 1.0001
That's all. That is the API.
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 ez-timer-0.0.2.tar.gz.
File metadata
- Download URL: ez-timer-0.0.2.tar.gz
- Upload date:
- Size: 2.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.25.1 requests-toolbelt/0.9.1 urllib3/1.26.5 tqdm/4.62.0 importlib-metadata/4.8.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
528debbe3e59a369f6eb755bc96f8be54b59b34e00da87b4502b2aecff146542
|
|
| MD5 |
db755a441b79411e2f27973beb857cd8
|
|
| BLAKE2b-256 |
57be029be6d0f3200b39b2e54ed15ca75c95ae3e8d97bb8fc34605de644de0da
|
File details
Details for the file ez_timer-0.0.2-py3-none-any.whl.
File metadata
- Download URL: ez_timer-0.0.2-py3-none-any.whl
- Upload date:
- Size: 2.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.25.1 requests-toolbelt/0.9.1 urllib3/1.26.5 tqdm/4.62.0 importlib-metadata/4.8.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9c9456423266a1276e4a037096fc6345f5b69b6e941e0230e0e6e79bab598c02
|
|
| MD5 |
380a94ae2b25b51bc1f5573f248933a9
|
|
| BLAKE2b-256 |
62c55e745951f7d31e3b10140f989587ed98d5792eefb75f241abc13643b50e9
|