Skip to main content

No project description provided

Project description

Pynchmark

Benchmarking tool for Python

Usage

Installation

pip install pynchmark

Automatic benchmark detection:

Benchmark is automatically detected by adding , <benchmark_name> next to the instruction, e.g.:

In my_bench.py:

import time


def benchmark_fun():

    time.sleep(1), "sleep1_bench"
    time.sleep(3), "sleep3_bench"

Then start benchmarks with:

$ pynchmark -f my_bench.py -b benchmark_fun -o results.csv

Will produce a results.csv file with:

          name,         time,          std,         cpus
  sleep1_bench,  1.000111500,  0.000390357,  0.548985640
  sleep3_bench,  3.000197003,  0.000279660,  0.150146124

Benchmark parameters:

To run the same benchmark with different values for one or more parameters:

In my_bench.py:

impott time
import pynchmark as pm


def benchmark_fun():

    for sleep_base in [0.1, 1, 10]:
        for sleep_number in [1, 2, 3]:

            pm.register_param(s=sleep_base, N=sleep_number)

            time.sleep(sleep_base*sleep_number), "sleep"

Then

$ pynchmark -f my_bench.py -b benchmark_fun

Will produce a results.csv file with:

   name,            s,  N,         time,          std,         cpus
  sleep,  0.100000000,  1,  0.100102915,  0.000129869,  0.830591585
  sleep,  0.100000000,  2,  0.200562054,  0.000355461,  0.075892409
  sleep,  0.100000000,  3,  0.300140898,  0.000016944,  0.414318679
  sleep,  1.000000000,  1,  1.000091083,  0.000107180,  0.148655625
  sleep,  1.000000000,  2,  2.000110503,  0.000182770,  0.429045753
  sleep,  1.000000000,  3,  3.000132126,  0.000098863,  0.346322218
  sleep, 10.000000000,  1, 10.000106712,  0.000191457,  0.285163832
  sleep, 10.000000000,  2, 20.000123678,  0.000403156,  0.471588462
  sleep, 10.000000000,  3, 30.000124734,  0.000205935,  0.542562585

Reuse previous benchmark results

Using -i <results_file> will load existing results, and only newly defined benchmarks will be run (benchmarks with same name and paramaters will be skipped, unless they have been in error).

For example:

$ pynchmark -i old_results.csv -f my_bench.py -b benchmark_fun -o new_results.csv

Other features (documentation TODO)

  • Results comparison
  • Plotting
  • Other functions in the API

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

pynchmark-0.0.1.tar.gz (6.9 kB view details)

Uploaded Source

Built Distribution

pynchmark-0.0.1-py3-none-any.whl (10.7 kB view details)

Uploaded Python 3

File details

Details for the file pynchmark-0.0.1.tar.gz.

File metadata

  • Download URL: pynchmark-0.0.1.tar.gz
  • Upload date:
  • Size: 6.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.11.9 Linux/6.10.3

File hashes

Hashes for pynchmark-0.0.1.tar.gz
Algorithm Hash digest
SHA256 f934f61cc32bc2fe5eb4bf48987e41efd5f92a37f917d38e1344e32c4f49e78e
MD5 e71b8ef8d86e078222704447677466ee
BLAKE2b-256 03769ffa4ce2933cfbfb4ba7d35067612aa53e456caa82fd4fd81bdc981fc863

See more details on using hashes here.

File details

Details for the file pynchmark-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: pynchmark-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 10.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.11.9 Linux/6.10.3

File hashes

Hashes for pynchmark-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 13324f8bb5bcbf45b940f169e6437d8f5353a5cce7c435e24078896397910021
MD5 ffff170fe589338a9b44ea2c7ff7176f
BLAKE2b-256 71e83e89db0115eb69b44526987b1cc1a22b40111a0250e0365a177d3ac4919a

See more details on using hashes here.

Supported by

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