perfbench is a perfomance benchmarking module for Python code.
Project description
License Build Status PyPI version
perfbench
About
perfbench is a perfomance benchmarking module for Python code.
Feature
Compatibility
perfbench works with Python 3.3 or higher.
Dependencies
ipython(6.0.0 or higher.)
tqdm(4.6.1 or higher.)
plotly(2.7.0 or lower)
Installation
pip install perfbench
Usage
plotting a single figure.
import numpy as np
from perfbench.process import *
setups = [
{'func': lambda n: np.random.uniform(low=-1., high=1., size=n).astype(np.float64), 'title': 'float64'}
]
kernels = [
{'func': lambda x: np.around(x), 'label': 'around'},
{'func': lambda x: np.rint(x), 'label': 'rint'}
]
ntimes = [2 ** n for n in range(15)]
bm = Benchmark(
setups=setups,
kernels=kernels,
ntimes=ntimes,
xlabel='samples',
title='test',
logx=True
)
bm.run()
bm.plot()
plotting multiple figures.
import numpy as np
from perfbench.process import *
setups = [
{'func': lambda n: np.random.uniform(low=-1., high=1., size=n).astype(np.float16), 'title': 'float16'},
{'func': lambda n: np.random.uniform(low=-1., high=1., size=n).astype(np.float32), 'title': 'float32'},
{'func': lambda n: np.random.uniform(low=-1., high=1., size=n).astype(np.float64), 'title': 'float64'}
]
kernels = [
{'func': lambda x: np.around(x), 'label': 'around'},
{'func': lambda x: np.rint(x), 'label': 'rint'}
]
ntimes = [2 ** n for n in range(5)]
bm = Benchmark(
setups=setups,
kernels=kernels,
ntimes=ntimes,
xlabel='samples',
title='test',
logx=True
)
bm.run()
bm.plot()
License
This software is released under the MIT License, see LICENSE.
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
perfbench-0.2.0.tar.gz
(61.2 kB
view hashes)
Built Distribution
Close
Hashes for perfbench-0.2.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5dc061ab12ec688845062b8806bdfdd801f0c7d10b72e09f40b9fb92542dc4de |
|
MD5 | 29bc2b6fd39daa8e54d6ae16ec886101 |
|
BLAKE2b-256 | 0744f6e35a6072fd765be4874f0002398db9dc19d99c7d22cf1a4ac60eab1f54 |