Skip to main content

System informations

Project description

Pypi Package Build Licence

https://github.com/ipselium/bmtools/blob/master/docs/compare.png

bmtools provides some tools dedicated to benchmarking.

Requirements

python:

>= 3.7

matplotlib:

>= 3.0

numpy:

>= 1.1

Installation

Clone the github repo and

$ python setup.py install

or install via Pypi

$ pip install bmtools

Compare execution times

Benchmarking functions execution can be done with Compare class as follows:

import numpy as np
from bmtools import Compare

def star_op(x):
    return x**0.5

def pow_op(x):
    return pow(x, 0.5)

def sqrt_op(x):
    return np.sqrt(x)

if __name__ == "__main__":

    # Single comparison
    bm1 = Compare(pow_op, star_op, sqrt_op, unit='ms')
    bm1.run(fargs=(np.random.rand(1000000), ), check_output=True)
    bm1.display()

    # Parametric comparison
    bm2 = Compare(pow_op, star_op, sqrt_op, unit='ms')
    for n in [2**n for n in range(16, 23)]:
        bm2.run(fargs=(np.random.rand(n), ), desc=n, check_output=True)

    bm2.bars()

Add time probes to your code

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

bmtools-0.1.2.tar.gz (6.0 kB view hashes)

Uploaded source

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page