Skip to main content

funcmeasure

PyPI - package version PyPI - license PyPI - python version PyPI - downloads

GitHub - last commit GitHub - commit activity

GitHub - code size in bytes GitHub - repo size GitHub - lines of code

GitHub - license

Description

Measure and compare function execution times

Install

pip install funcmeasure
# or
pip3 install funcmeasure

Usage

from funcmeasure import measure, FunctionStats, TableFormat

def f1():
    5**2

def f2():
    5**2**10

def f3():
    5**2**2**2

# stats = measure([f1, (f2, 'second'), f3], times=1000)
# or
stats = measure(
    {
        f1: None,
        f2: 'second',
        f3: None
    },
    times=1000
)

# prints
#
# Ran 3 functions. 1000 times each.
#
# ╒════╤════════╤════════════╤══════════════╤═════════════╤══════════════╤═════════════╕
# │    │   Name │   Avg (ms) │   Total (ms) │   Best (ms) │   Worst (ms) │   Benchmark │
# ╞════╪════════╪════════════╪══════════════╪═════════════╪══════════════╪═════════════╡
# │  0 │     f3 │   0.002123 │     2.122589 │    0.001892 │     0.007872 │             │
# ├────┼────────┼────────────┼──────────────┼─────────────┼──────────────┼─────────────┤
# │  1 │     f1 │   0.002282 │     2.281747 │    0.001952 │     0.062483 │      ~1.07x │
# ├────┼────────┼────────────┼──────────────┼─────────────┼──────────────┼─────────────┤
# │  2 │ second │   0.004946 │     4.946447 │    0.004395 │     0.053278 │      ~2.33x │
# ╘════╧════════╧════════════╧══════════════╧═════════════╧══════════════╧═════════════╛

Dependencies

jsoncodable, tabulate

Metadata

Release files for funcmeasure 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for funcmeasure 0.1.2
File Size Uploaded
funcmeasure-0.1.2.tar.gz 6.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for funcmeasure 0.1.2
File Interpreter ABI Platform
funcmeasure-0.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 15.2 kB

Release files / funcmeasure-0.1.2.tar.gz

Download URL funcmeasure-0.1.2.tar.gz
Size 6.4 kB
Tags Source
SHA-256 checksum
How to use checksums
139f8313789ae086a1cd9e53e710e36651da9c8cf9d6a3ec8ebc45862274d3e0
BLAKE2b-256 checksum
How to use checksums
32c528f7a762d9aa6e9b3d2500462e58cd750c6707b7d6ffaa28a0f31f980ea8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.5.0.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.7.9

Release files / funcmeasure-0.1.2-py3-none-any.whl

Download URL funcmeasure-0.1.2-py3-none-any.whl
Size 8.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
27ee3024ea0523881c72d5ec95c66d5053473db8c125bbdfe1b6d26c4574ef57
BLAKE2b-256 checksum
How to use checksums
f738dd64d835854966efe331f7c9c4ebc7a221a3599ed7324e2fee8ce295922d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.5.0.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.7.9

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release 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