Skip to main content

perf8

https://github.com/tarekziade/perf8/actions/workflows/ci.yml/badge.svg?branch=main

THIS IS ALPHA QUALITY, UNSUPPORTED, RUN AT YOUR OWN RISKS

Your Tool For Python Performance Tracking

perf8 is a curated list of tools to track the performance of your Python app.

The project is pluggable, and ships with a few tools:

  • cprofile - a cProfile to Dot graph generator

  • pyspy - a py-spy speedscope generator

  • memray - a memory flamegraph generator

  • psutil - a psutil integration

  • asyncstats - stats on the asyncio eventloop usage (for async apps)

Installation

Use pip:

pip install perf8

If you use the cprofile plugin, you will need to install Graphviz to get the dot utility. See. https://graphviz.org/download/

Usage

Running the perf8 command against your Python module:

perf8 --all -c /my/python/script.py --option1

Will generate a self-contained HTML report, making it suitable for running it in automation and produce performance artifacts.

You can pick specific plugins. Run perf –help and use the ones you want.

Async applications

Running the asyncstats plugin requires to provide your application event loop.

In order to do this, you need to instrument your application to give perf8 the loop to watch. You can use the enable and disable coroutines:

import perf8

async def my_app():
     await perf8.enable(my_loop)
     try:
         # my code
         await run_app()
     finally:
         await perf8.disable()

To avoid running this code in production you can use the PERF8 environment variable to detect if perf8 is calling your app:

import os

if 'PERF8' in os.environ:
    import perf8

    async with perf8.measure():
        await run_app()
 else:
     await run_app()

Screencast

docs/perf8-screencast.gif

0.0.1 - 2023/01/06

  • Initial release

0.0.0 - 2022/11/11

  • Don’t use it.

Metadata

Release files for perf8 0.0.1

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

Source distribution (sdist)

Source distribution for perf8 0.0.1
File Size Uploaded
perf8-0.0.1.tar.gz 656.6 kB Details

Release files / perf8-0.0.1.tar.gz

Download URL perf8-0.0.1.tar.gz
Size 656.6 kB
Tags Source
SHA-256 checksum
How to use checksums
7dadf24869cae705b3027a2349611d40134283cbc5900e34be128489fd688e84
BLAKE2b-256 checksum
How to use checksums
ff1d5985968bbca76bedd748eb6a017ba1a2368f925c682eaace3b5454669abb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.7

Release history Release notifications | RSS feed

This release

0.0.1 This release

1 release file

0.0.0

1 release file

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