timeit for multiple functions with better reporting
Project description
timeit for multiple functions with better reporting
Free software: MIT License
Installation
pip install timethese
You can also install the in-development version with:
pip install https://github.com/jwbargsten/python-timethese/archive/master.zip
Usage
To use TimeThese in a project:
from timethese import cmpthese, pprint_cmp, timethese xs = range(10) def map_hex(): list(map(hex, xs)) def list_compr_hex(): list([hex(x) for x in xs]) def map_lambda(): list(map(lambda x: x + 2, xs)) def map_lambda_fn(): fn = lambda x: x + 2 list(map(fn, xs)) def list_compr_nofn(): list([x + 2 for x in xs]) cmp_res_dict = cmpthese( 10000, { "map_hex": map_hex, "list_compr_hex": list_compr_hex, "map_lambda": map_lambda, "map_lambda_fn": map_lambda_fn, "list_compr_nofn": list_compr_nofn, }, repeat=3, ) print(pprint_cmp(cmp_res_dict)) cmp_res_list = cmpthese( 10000, [map_hex, list_compr_hex, map_lambda, map_lambda_fn, list_compr_nofn,], repeat=3, ) print(pprint_cmp(cmp_res_list))
Development
To run the all tests run:
tox
Note, to combine the coverage data from all the tox environments run:
Windows |
set PYTEST_ADDOPTS=--cov-append tox |
---|---|
Other |
PYTEST_ADDOPTS=--cov-append tox |
Changelog
0.0.3 (2020-05-27)
First release on PyPI.
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
timethese-0.0.3.tar.gz
(15.5 kB
view hashes)
Built Distribution
Close
Hashes for timethese-0.0.3-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8d94e8fbde41b2da81980b62ddb6f1e089f219988f2cf9ed1e3106bdfb9e4946 |
|
MD5 | 4fa8c7c195d15dede0d9fca0b7240ddc |
|
BLAKE2b-256 | c2d9a05db6acfcdf860fa5fd6243f18032e884dd017256a5b44495380d2f40e5 |