Skip to content

Instantly share code, notes, and snippets.

@nelhage
Created February 10, 2025 03:50
Show Gist options
  • Save nelhage/0ad24619e4a0bc4e407d05da0db00125 to your computer and use it in GitHub Desktop.
Save nelhage/0ad24619e4a0bc4e407d05da0db00125 to your computer and use it in GitHub Desktop.
Exploring benchmarks for CPython's tail-call JIT
❯ PYTHONHASHSEED=11 taskset -c 0-11 perf stat $tailcall -u venv/lib/python3.12/site-packages/pyperformance/data-files/benchmarks/bm_unpack_sequence/run_benchmark.py tuple -p1 -n1 -l 5000
.
unpack_sequence_tuple: 22.0 ns
Performance counter stats for 'venv/cpython3.14-fbced5d02230-compat-af96b9431081/bin/python -u venv/lib/python3.12/site-packages/pyperformance/data-files/benchmarks/bm_unpack_sequence/run_benchmark.py tuple -p1 -n1 -l 5000':
244.38 msec task-clock:u # 0.998 CPUs utilized
0 context-switches:u # 0.000 /sec
0 cpu-migrations:u # 0.000 /sec
6,340 page-faults:u # 25.943 K/sec
<not counted> cpu_atom/instructions/u (0.00%)
1,860,506,925 cpu_core/instructions/u # 3.43 insn per cycle
<not counted> cpu_atom/cycles/u (0.00%)
541,688,315 cpu_core/cycles/u # 2.217 GHz
<not counted> cpu_atom/branches/u (0.00%)
316,346,365 cpu_core/branches/u # 1.294 G/sec
<not counted> cpu_atom/branch-misses/u (0.00%)
3,523,902 cpu_core/branch-misses/u # 1.11% of all branches
TopdownL1 (cpu_core) # 6.5 % tma_backend_bound
# 13.3 % tma_bad_speculation
# 27.7 % tma_frontend_bound
# 52.5 % tma_retiring
0.244815704 seconds time elapsed
0.219950000 seconds user
0.023853000 seconds sys
❯ PYTHONHASHSEED=11 taskset -c 0-11 perf stat $goto -u venv/lib/python3.12/site-packages/pyperformance/data-files/benchmarks/bm_unpack_sequence/run_benchmark.py tuple -p1 -n1 -l 5000
.
unpack_sequence_tuple: 27.5 ns
Performance counter stats for 'venv/cpython3.14-0386bad6388d-compat-af96b9431081/bin/python -u venv/lib/python3.12/site-packages/pyperformance/data-files/benchmarks/bm_unpack_sequence/run_benchmark.py tuple -p1 -n1 -l 5000':
267.09 msec task-clock:u # 0.998 CPUs utilized
0 context-switches:u # 0.000 /sec
0 cpu-migrations:u # 0.000 /sec
6,329 page-faults:u # 23.697 K/sec
<not counted> cpu_atom/instructions/u (0.00%)
1,824,738,642 cpu_core/instructions/u # 3.05 insn per cycle
<not counted> cpu_atom/cycles/u (0.00%)
597,365,501 cpu_core/cycles/u # 2.237 GHz
<not counted> cpu_atom/branches/u (0.00%)
391,773,160 cpu_core/branches/u # 1.467 G/sec
<not counted> cpu_atom/branch-misses/u (0.00%)
3,528,953 cpu_core/branch-misses/u # 0.90% of all branches
TopdownL1 (cpu_core) # 5.9 % tma_backend_bound
# 11.8 % tma_bad_speculation
# 35.5 % tma_frontend_bound
# 46.7 % tma_retiring
0.267620493 seconds time elapsed
0.235486000 seconds user
0.031021000 seconds sys
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment