A decorator/wrapper package to time a given function.
Project description
functimer
A decorator/wrapper package to time a given function.
Installation
-
PYPI:
pip install functimer
-
Manual:
poetry build pip install dist/*.whl
How to install Poetry.
Quick Example
Comprehensive Examples in examples
-
Python
@timed(unit=Unit.second, number=1) def timed_sleep(seconds): sleep(seconds) runtime = timed_sleep(1) "1.00 s"
-
Command Line
$ python -m functimer "sum([1, 2, 3])" Average runtime of 10,000 executions: 0.15 µs $ python -m functimer "sum([1, 2, 3])" --return Average runtime of 10,000 executions: 0.15 µs sum([1, 2, 3]) -> 6 $ python -m functimer "(lambda x: x+x)(10)" --return Average runtime of 10,000 executions: 0.14 µs (lambda x: x+x)(10) -> 20 $ python -m functimer "functimer.util.get_unit('1.00 s')" --return Average runtime of 10,000 executions: 0.50 µs functimer.util.get_unit('1.00 s') -> Unit.second $ python -m functimer "functimer.classes.Unit.from_str('s')" --return Average runtime of 10,000 executions: 0.25 µs functimer.classes.Unit.from_str('s') -> Unit.second
Tests
Run tox
in the root directory of the repo.
License
MIT
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
functimer-1.2.3.tar.gz
(9.0 kB
view hashes)
Built Distribution
functimer-1.2.3-py3-none-any.whl
(11.8 kB
view hashes)
Close
Hashes for functimer-1.2.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ac736247137d66f6cc85be243a9d7a25cdde1badf8a0cbc9447a188d2f377895 |
|
MD5 | d81ff2a5763a92e2de0e1ca714dd3e57 |
|
BLAKE2b-256 | 1014ef9a46e34f9551aec2dd5c0805c1e4e42439fbced28adf105791875520fa |