Skip to main content

speed-profiler

Accurate speed profiler for Python code using perf_counter.

This module is for finding bottlenecks in Python code. The first call to the module initializes it with a name to identify the profile. Following that are calls to mark() for timing purposes. Here's an example (Also in the demo folder):

Installation

pip install speed-profiler

Usage

from speed_profiler import SpeedProfiler
from time import sleep
from pprint import pprint

sp = SpeedProfiler('Sleep Tester')


def foo():
    sleep(0.2)
    sp.mark('Foo')


def bar():
    sleep(0.1)
    sp.mark('bar')


def baz():
    foo()
    bar()
    sp.mark('baz')
    profile = sp.stop()
    pprint(profile)


baz()

Output:

[{'duration': 0.20027251401916146,
  'identifier': 'Sleep Tester',
  'line_num': 5,
  'percent_time': 66.66},
 {'duration': 0.10016519500641152,
  'identifier': 'Foo',
  'line_num': 10,
  'percent_time': 33.34},
 {'duration': 1.0420975740998983e-05,
  'identifier': 'bar',
  'line_num': 15,
  'percent_time': 0.0},
 {'duration': 9.390001650899649e-06,
  'identifier': 'baz',
  'line_num': 21,
  'percent_time': 0.0}]

Metadata

Release files for speed-profiler 0.0.4

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

Source distribution (sdist)

Source distribution for speed-profiler 0.0.4
File Size Uploaded Provenance Actions
speed-profiler-0.0.4.tar.gz 2.5 kB Without provenance Details for speed-profiler-0.0.4.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for speed-profiler 0.0.4
File Interpreter ABI Platform Actions
speed_profiler-0.0.4-py3-none-any.whl Python 3 none any Details for speed_profiler-0.0.4-py3-none-any.whl

Total release size: 6.0 kB

Release files / speed-profiler-0.0.4.tar.gz

Download URL speed-profiler-0.0.4.tar.gz
Size 2.5 kB
Tags Source
SHA-256 checksum
How to use checksums
bf61c833364ef9d6539785a94a6a93d094af518318fad7685883129e6d963e7c
BLAKE2b-256 checksum
How to use checksums
4800bffdc3f17ad525e484752b469c6f7a3f6a8e8bcfe23648877a970225de6c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.0.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.8.1

Release files / speed_profiler-0.0.4-py3-none-any.whl

Download URL speed_profiler-0.0.4-py3-none-any.whl
Size 3.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
02f99adf688fd1adb7597fbb9e55e90bb41235f5d2e18fce17338a9f93dd691f
BLAKE2b-256 checksum
How to use checksums
deade8c10e3c1447c3ca65b4134b5c138a7fde4887048c288ef7345192bb9389
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.0.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.8.1

Security for speed-profiler 0.0.4

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.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.0.4 This release

2 release files No provenance

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