Skip to main content

Pyros Performance

A high-performance Python library for benchmarking and profiling your code. it can be used for both ros2 functions and non-ros2 functions. project is part of the pyros library.

Installation

pip install pyros-performance

Quick Start

from pyros_performance import profiler, render
import threading

@profiler()
def sum_numbers(*args):
    total = 0
    for _ in range(200000):
        for v in args:
            total += v
        total *= 1
    return total


@profiler()
def heavy_math():
    x = 0
    for i in range(300000):
        x += i * 0.5
        x = x % 100000
    return x

if __name__ == "__main__":

    # start dashboard thread
    t = threading.Thread(target=render, daemon=True)
    t.start()

    # simulate workload
    while True:
        sum_numbers(1, 2, 3)
        heavy_math()
        time.sleep(0.2)

Example Output

============================================================
           ROS2 LIGHTWEIGHT PROFILER
============================================================

SYSTEM
------------------------------------------------------------
CPU Total: 6.9%
Memory RSS: 13.31 MB

Per-Core CPU:
Core 00:                      2.0%
Core 01:                      4.0%
Core 02: ██                   11.8%
Core 03:                      2.0%
Core 04: █                    6.1%
Core 05: ██                   13.7%
Core 06: ██████               31.4%
Core 07:                      0.0%
Core 08: █                    6.0%
Core 09: █                    6.0%
Core 10:                      0.0%
Core 11:                      4.0%
Core 12:                      4.0%
Core 13: █                    5.9%
Core 14: █                    6.0%
Core 15:                      3.9%

FUNCTIONS
------------------------------------------------------------

sum_numbers
  calls     : 5
  wall avg  : 15.630 ms
  cpu avg   : 16.000 ms
  last wall : 14.789 ms
  last cpu  : 20.000 ms

heavy_math
  calls     : 5
  wall avg  : 13.479 ms
  cpu avg   : 12.000 ms
  last wall : 12.910 ms
  last cpu  : 10.000 ms

============================================================

Features

  • Easy benchmarking - Simple API for measuring execution time
  • Memory profiling - Track memory usage during execution
  • Performance reports - Generate detailed performance metrics
  • Low overhead - Minimal impact on your code performance

Documentation

For detailed documentation, visit GitHub.

Requirements

  • Python 3.8+

License

MIT

Contributing

Contributions welcome! Please submit pull requests or issues on GitHub.

Metadata

Release files for pyros-performance 0.1.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 pyros-performance 0.1.4
File Size Uploaded Provenance Actions
pyros_performance-0.1.4.tar.gz 4.1 kB Without provenance Details for pyros_performance-0.1.4.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pyros-performance 0.1.4
File Interpreter ABI Platform Actions
pyros_performance-0.1.4-py3-none-any.whl Python 3 none any Details for pyros_performance-0.1.4-py3-none-any.whl

Total release size: 8.8 kB

Release files / pyros_performance-0.1.4.tar.gz

Download URL pyros_performance-0.1.4.tar.gz
Size 4.1 kB
Tags Source
SHA-256 checksum
How to use checksums
e49e14212d9cd1c2958e17485ef0134c288ebcec099671aa9c4bb0540c53725a
BLAKE2b-256 checksum
How to use checksums
1d6189db0b790092386624ee065f151b33e4e5bf6856f12017ed56cbcb2e5c76
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.20

Release files / pyros_performance-0.1.4-py3-none-any.whl

Download URL pyros_performance-0.1.4-py3-none-any.whl
Size 4.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0eeb0722fec0ad61840e5d6ce3980a368afd85549f5d7bb625ab0d951e2c68a4
BLAKE2b-256 checksum
How to use checksums
690ffa2894feec8213df813568b352d0a71f32bbbf5d28d69f1663e0b25bac63
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.20

Security for pyros-performance 0.1.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.

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