Overview

PyPI Package latest release PyPI Wheel Supported versions Supported implementations

Python Performance Analysis Library or py-pal is a bytecode profiling toolkit.

Installation

This project requires CPython to run. Install Python >= 3.7, then install py-pal by running:

pip install py-pal

Documentation

TBA

Overview

Calling py-pal as module with

python -m py_pal file.py

or

pypal file.py

Measure specific functions using the decorator:

from py_pal.core import profile

@profile
def test():
    pass

Using the context manager:

from py_pal.estimator import AllArgumentEstimator
from py_pal.tracer import Tracer

with Tracer() as t:
    pass

estimator = AllArgumentEstimator(t)
res = estimator.export()

# Do something with the resulting DataFrame
print(res)

Using the API:

from py_pal.estimator import AllArgumentEstimator
from py_pal.tracer import Tracer


t = Tracer()
t.trace()

# Your function
pass

t.stop()
estimator = AllArgumentEstimator(t)
res = estimator.export()

# Do something with the resulting DataFrame
print(res)

Modes

Profiling and Performance Testing

Restrictions

The Tracing process does not work for multi-threaded code.

Tracing processes

Development

To run the all tests run:

pip install -r dev-requirements.txt

pytest tests tests_cython

FAQ

Why not use a standard profiler?

Using absolute timing data vs synthetic timing data using opcodes.

Licensing Notes

This work integrates some code from the big_O project. More specifically, most code in py_pal.complexity, py_pal.datagen and py_pal.estimator.Estimator.infer_complexity is adapted from bigO.