Skip to main content
Documentation Status https://badge.fury.io/py/benchpress.svg

Quick Start

Fire up your terminal, and:

# Install using PyPi
pip install benchpress --user

# Make the Benchpress binaries available
export PATH=$PATH:$HOME/.local/bin

Specify what to benchmark by implementing a Python script that generates commands:

import benchpress as bp
from benchpress.suite_util import BP_ROOT

scripts = [
    ('X-ray',  'xraysim',  ["10*10*1", "20*10*1"]),
    ('Bean',   'galton_bean_machine',  ["10000*10", "20000*10"]),
]

cmd_list = []
for label, name, sizes in scripts:
    for size in sizes:
        full_label = "%s/%s" % (label, size)
        bash_cmd = "python {root}/benchmarks/{script}/python_numpy/{script}.py {size}" \
                    .format(root=BP_ROOT, script=name, size=size)
        cmd_list.append(bp.command(bash_cmd, full_label))

# Finally, we build the Benchpress suite, which is written to `--output`
bp.create_suite(cmd_list)

And run the script:

$ python suites/simple_example.py --output my_benchmark.json
Scheduling 'X-ray/10*10*1': 'python xraysim/python_numpy/xraysim.py --size=10*10*1'
Scheduling 'X-ray/20*10*1': 'python xraysim/python_numpy/xraysim.py --size=20*10*1'
Scheduling 'Bean/10000*10': 'python galton_bean_machine/python_numpy/galton_bean_machine.py --size=10000*10'
Scheduling 'Bean/20000*10': 'python galton_bean_machine/python_numpy/galton_bean_machine.py --size=20000*10'
Writing suite file: my_benchmark.json

The result is a JSON file results.json that encapsulate the commands that make up the benchmark suite. Now, use bp-run to run the benchmark suite:

$bp-run results.json
Executing 'X-ray/10*10*1'
Executing 'X-ray/20*10*1'
Executing 'Bean/10000*10'
Executing 'Bean/20000*10'

Finally, let’s visualize the results in ASCII:

$bp-cli results.json
X-ray/10*10*1: [0.013303, 0.013324, 0.012933] 0.0132 (0.0002)
X-ray/20*10*1: [0.108884, 0.105319, 0.105392] 0.1065 (0.0017)
Bean/10000*10: [0.002653, 0.002553, 0.002616] 0.0026 (0.0000)
Bean/20000*10: [0.005149, 0.005088, 0.005271] 0.0052 (0.0001)

Or as a bar chart:

$bp-chart results.json --output results.pdf
Writing file 'results.pdf' using format 'pdf'.
https://raw.githubusercontent.com/bh107/benchpress/master/doc/source/_static/quickstart_results.png

Download files

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

Source Distribution

benchpress-3.0.5.post16.tar.gz (1.4 MB view details)

Uploaded Source

File details

Details for the file benchpress-3.0.5.post16.tar.gz.

File metadata

  • Download URL: benchpress-3.0.5.post16.tar.gz
  • Upload date:
  • Size: 1.4 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/38.2.4 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/2.7.14

File hashes

Hashes for benchpress-3.0.5.post16.tar.gz
Algorithm Hash digest
SHA256 a64217b0d097a27c0c7b9caf7428013ba4c46ab9175a7c5db00c572cb385da87
MD5 bed1908f503bac51d9e006fa80408606
BLAKE2b-256 d0643caf1c843ab5a99c0d0ca779a099bc024b16e229028ad70b2e2c3e1d1982

See more details on using hashes here.

Release history Release notifications | RSS feed

3.0.5.post18

1 file

This release

3.0.5.post16 This release

1 file

3.0.5.post14

1 file

3.0.5.post13

1 file

3.0.5.post10

1 file

3.0.5.post8

1 file

3.0.5.post6

1 file

3.0.5.post3

1 file

3.0.5

1 file

3.0.4.post66

1 file

3.0.4.post65

1 file

3.0.4.post38

1 file

3.0.4.post34

1 file

3.0.4.post31

1 file

3.0.4.post30

1 file

3.0.4.post28

1 file

3.0.4.post27

1 file

3.0.4.post24

1 file

3.0.4.post23

1 file

3.0.4.post22

1 file

3.0.4.post21

1 file

3.0.4.post20

1 file

3.0.4.post19

1 file

3.0.4.post17

1 file

3.0.4.post16

1 file

3.0.4.post14

1 file

3.0.4.post12

1 file

3.0.4.post10

1 file

3.0.4.post9

1 file

3.0.4.post8

1 file

3.0.4.post7

1 file

3.0.4.post6

1 file

3.0.4.post4

1 file

3.0.3

1 file

3.0.2

1 file

3.0.1

1 file

3.0

1 file

1.0

2 files

0.9

2 files

0.8

2 files

0.7

2 files

0.6

2 files

0.5

2 files

0.1

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page