paragon
A tiny command line benchmarking utility (and a python library!)
Demo
Features
- Statistical analysis
- Cool progress bars
- Python library
- Export results to various file formats (todo)
Installation
You can install the command line utility via pip:
$ pip install paragon
Usage
You can use paragon as a command line utility or a python library.
CLI
After running --help:
Options:
-a, --accuracy INTEGER Number of iterations
-f, --files PATH Input file path(s)
-o, --output PATH Output file path
--help Show this message and exit.
Examples:
Benchmarking code as a string:
$ paragon "print('hello, world')" -a 20
Providing a python file:
$ paragon -f /path/to/file.py
Exporting results
You can use the -o option to specify an ouput file which will receive the results. Paragon currently supports Markdown, CSV and JSON file formats.
For instance, specifying a Markdown output file will yield this result:
| Program | Average [s] | Min [s] | Max [s] |
|---|---|---|---|
for i in range(2500): print(i ** i) |
102.45 | 97.6 | 114.0 |
comp |
230.27 | 226.6 | 236.6 |
hello |
10.23 | 10.1 | 10.5 |
sort |
429.49 | 421.8 | 438.2 |
Library
Example:
from paragon import Paragon
n = 1000000
def main():
"""entry point"""
fizzbuzz(n)
fib_wrapper(30)
@Paragon.benchmark(name="FizzBuzz!", accuracy=20)
def fizzbuzz(n):
return list(
map(
lambda i: "Fizz" * (i % 3 == 0) + "Buzz" * (i % 5 == 0) or str(i),
range(1, n),
)
)
# You must wrap your recursive functions
@Paragon.benchmark(name="Fibonacci!", accuracy=20)
def fib_wrapper(n):
def fib(n):
return 1 if n in [0, 1] else fib(n - 1) + fib(n - 2)
fib(n)
if __name__ == "__main__":
main()
Further Ramblings
Paragon is heavily inspired by the shell benchmarking tool hyperfine. Although currently less mature, it has room to grow. For now, it is a simple tool that can be used to run quick and easy benchmarks for Python code with minimal setup.
Metadata
Release files for paragon 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| paragon-1.0.0.tar.gz | 8.8 kB | Without provenance | Details |
Release files / paragon-1.0.0.tar.gz
| Download URL | paragon-1.0.0.tar.gz |
|---|---|
| Size | 8.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
dd0b4364ca1ab17b06e31173d5014f6a1d36e5538aee95c89e646f80477088ff
|
|
BLAKE2b-256 checksum How to use checksums |
f39f843b8c9a719695bc6d5ee5f70960513919367a9dc031163db1e70803f78e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.8.2
|
Security for paragon 1.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.