A simple benchmarking package.
Project description
A simple benchmarking package.
Documentation
Downloads
Installation
Using pip:
python -m pip install simple_benchmark
Or installing the most recent version directly from git:
python -m pip install git+https://github.com/MSeifert04/simple_benchmark.git
To utilize the all features of the library (for example visualization) you need to install the optional dependencies:
Or install them automatically using:
python -m pip install simple_benchmark[optional]
Getting started
Suppose you want to compare how NumPys sum and Pythons sum perform on lists of different sizes:
>>> from simple_benchmark import benchmark >>> import numpy as np >>> funcs = [sum, np.sum] >>> arguments = {i: [1]*i for i in [1, 10, 100, 1000, 10000, 100000]} >>> argument_name = 'list size' >>> aliases = {sum: 'Python sum', np.sum: 'NumPy sum'} >>> b = benchmark(funcs, arguments, argument_name, function_aliases=aliases)
The result can be visualized with pandas (needs to be installed):
>>> b Python sum NumPy sum 1 9.640884e-08 0.000004 10 1.726930e-07 0.000004 100 7.935484e-07 0.000008 1000 7.040000e-06 0.000042 10000 6.910000e-05 0.000378 100000 6.899000e-04 0.003941
Or with matplotlib (has to be installed too):
>>> b.plot()
To save the plotted benchmark as PNG file:
>>> import matplotlib.pyplot as plt >>> plt.savefig('sum_example.png')
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
File details
Details for the file simple_benchmark-0.0.9.tar.gz
.
File metadata
- Download URL: simple_benchmark-0.0.9.tar.gz
- Upload date:
- Size: 8.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7fbf38f5a833578e9c91011402d0827fdac81d6812dd1dcc522e960c1bc25dfc |
|
MD5 | cd09a208f277bd2e711c84831afad210 |
|
BLAKE2b-256 | 97a6de5e20e73dda8e310f5e2c5f43aee480097aca8bab3db928105344d37774 |