Skip to main content

Performance plots for Python code snippets

Project description

Build Status codecov PyPi Version GitHub stars

perfplot extends Python’s very own timeit by testing snippets with input parameters (e.g., the size of an array) and plotting the results. (By default, perfplot asserts the equality of the output of all snippets, too.)

For example, to compare different NumPy array concatenation methods, the script

import numpy
import perfplot

perfplot.show(
        setup=numpy.random.rand,
        kernels=[
            lambda a: numpy.c_[a, a],
            lambda a: numpy.stack([a, a]).T,
            lambda a: numpy.vstack([a, a]).T,
            lambda a: numpy.column_stack([a, a]),
            lambda a: numpy.concatenate([a[:, None], a[:, None]], axis=1)
            ],
        labels=['c_', 'stack', 'vstack', 'column_stack', 'concat'],
        n_range=[2**k for k in range(15)],
        xlabel='len(a)'
        )

produces

Clearly, stack and vstack are the best options for large arrays!

Installation

Python Package Index

perfplot is available from the Python Package Index, so simply do

pip install -U perfplot

to install or upgrade.

Testing

To run the perfplot unit tests, check out this repository and type

pytest

Distribution

To create a new release

  1. bump the __version__ number,

  2. publish to PyPi and tag on GitHub:

    $ make publish

License

perfplot is published under the MIT license.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

perfplot-0.2.5-py2.py3-none-any.whl (6.2 kB view details)

Uploaded Python 2Python 3

File details

Details for the file perfplot-0.2.5-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for perfplot-0.2.5-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 d32f7e913c6b6585d660ea3ee2e48c209f3dfb273b8134b71baaa4385ebc7981
MD5 1395e612143d0a8b0f89b30b383181db
BLAKE2b-256 e8a6c7e0af563f3210adcfe8348c4a761f8f4f1aa37854bd503705dc73a650d4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page