Simple performance measurement tool
neurtu is a Python package providing a common interface for multi-metric benchmarks (including time and memory measurements). It can can be used to estimate time and space complexity of algorithms, while pandas integration allows quick analysis and visualization of the results.
neurtu means “to measure / evaluate” in Basque language.
See the documentation for more details.
Installation
neurtu requires Python 2.7 or 3.4+, it can be installed with,
pip install neurtu
pandas >=0.20 is an optional (but highly recommended) dependency.
Quickstart
To illustrate neurtu usage, will will benchmark array sorting in numpy. First, we will generator of cases,
import numpy as np
import neurtu
def cases()
rng = np.random.RandomState(42)
for N in [1000, 10000, 100000]:
X = rng.rand(N)
tags = {'N' : N}
yield neurtu.delayed(X, tags=tags).sort()
that yields a sequence of delayed calculations, each tagged with the parameters defining individual runs.
We can evaluate the run time with,
>>> df = neurtu.timeit(cases())
>>> print(df)
wall_time
N
1000 0.000014
10000 0.000134
100000 0.001474
which will internally use timeit module with a sufficient number of evaluation to work around the timer precision limitations (similarly to IPython’s %timeit). It will also display a progress bar for long running benchmarks, and return the results as a pandas.DataFrame (if pandas is installed).
By default, all evaluations are run with repeat=1. If more statistical confidence is required, this value can be increased,
>>> neurtu.timeit(cases(), repeat=3)
wall_time
mean max std
N
1000 0.000012 0.000014 0.000002
10000 0.000116 0.000149 0.000029
100000 0.001323 0.001714 0.000339
In this case we will get a frame with a pandas.MultiIndex for columns, where the first level represents the metric name (wall_time) and the second – the aggregation method. By default neurtu.timeit is called with aggregate=['mean', 'max', 'std'] methods, as supported by the pandas aggregation API. To disable, aggregation and obtains timings for individual runs, use aggregate=False. See neurtu.timeit documentation for more details.
To evaluate the peak memory usage, one can use the neurtu.memit function with the same API,
>>> neurtu.memit(cases(), repeat=3)
peak_memory
mean max std
N
10000 0.0 0.0 0.0
100000 0.0 0.0 0.0
1000000 0.0 0.0 0.0
More generally neurtu.Benchmark supports a wide number of evaluation metrics,
>>> bench = neurtu.Benchmark(wall_time=True, cpu_time=True, peak_memory=True)
>>> bench(cases())
cpu_time peak_memory wall_time
N
10000 0.000100 0.0 0.000142
100000 0.001149 0.0 0.001680
1000000 0.013677 0.0 0.018347
including psutil process metrics.
For more information see the documentation and examples.
License
neurtu is released under the 3-clause BSD license.
Metadata
Release files for neurtu 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| neurtu-0.3.0.tar.gz | 20.6 kB | Without provenance | Details for neurtu-0.3.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| neurtu-0.3.0-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details for neurtu-0.3.0-py2.py3-none-any.whl |
Total release size: 35.5 kB
Release files / neurtu-0.3.0.tar.gz
| Download URL | neurtu-0.3.0.tar.gz |
|---|---|
| Size | 20.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
260a3f3884a09132f43a89613e670e9dc4ab4f32e9afa4a57bbc836bd61615b9
|
|
BLAKE2b-256 checksum How to use checksums |
622f30541acbf0a9e76552ca56c62696454ad0d189be1fb0577dca0b1f126015
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.28.1 CPython/3.7.3
|
Release files / neurtu-0.3.0-py2.py3-none-any.whl
| Download URL | neurtu-0.3.0-py2.py3-none-any.whl |
|---|---|
| Size | 14.9 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
033aab806c54cba4accb0c8b25b9b8584a8ccd3c65cadf94f4e668dda99008f9
|
|
BLAKE2b-256 checksum How to use checksums |
4be307f0e7b207798e45b553763f7b5d7beeb2e9965888bf3638dd5c627958ad
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.28.1 CPython/3.7.3
|
Security for neurtu 0.3.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.