Skip to content

Conversation

@maurycy
Copy link
Contributor

@maurycy maurycy commented Jan 24, 2026

The PR adds support for profiling benchmarks with a Tachyon hook.

It's enabled only during benchmark execution. It supports nearly all flags as environment variables, and there's a guard for versions below 3.15. It's disabled on Windows, since I don't have access to any.

I'm not sure if this should be merged before October 2026, but it's a good way to verify Tachyon itself and offers a new way to profile the whole pyperformance suite.

Basic way to test:

uv run --python 3.15 -m pyperf timeit --hook tachyon '[x**2 for x in range(1000)]'

pyperformance

I was able to run the whole pyperformance suite with it:

PYPERF_TACHYON_EXTRA_OPTS="--flamegraph" \
PYTHONPATH=/home/maurycy/github.com/maurycy/pyperf \
uv run --python 3.15 --with /home/maurycy/github.com/maurycy/pyperf/pyperformance \
python -c "import pyperformance.cli; pyperformance.cli.main()" run \
  --fast \
  --hook tachyon \
  --inherit-environ PYPERF_TACHYON_EXTRA_OPTS

notes

  • Beyond the scope, but the hook subsystem could be more granular (any interest?), so WorkerTask etc. wouldn't be included,
  • profiling.sampling does not seem to offer a way to stop, except killing the process (not the urgent priority),
  • What would be the best way to write a test for it?

pyperf/_hooks.py Outdated
PYPERF_TACHYON_ALL_THREADS: Set to "1" to profile all threads
PYPERF_TACHYON_NATIVE: Set to "1" to include the native frames
PYPERF_TACHYON_ASYNC_AWARE: Set to "1" for async-aware profiling
PYPERF_TACHYON_EXTRA_OPTS: Extra arguments passed to
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not just calling it PYPERF_TACHYON_OPTS?

Copy link
Contributor Author

@maurycy maurycy Jan 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vstinner Changed: 5791a4e

To be honest, I just copied the convention from perf_record:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants