Benchmark | goto | tail-call | goto-mine |
---|---|---|---|
2to3 | 345 ms | 331 ms: 1.04x faster | 340 ms: 1.02x faster |
docutils | 3.27 sec | 3.22 sec: 1.02x faster | 3.26 sec: 1.00x faster |
html5lib | 72.6 ms | 69.6 ms: 1.04x faster | 73.6 ms: 1.01x slower |
Geometric mean | (ref) | 1.03x faster | 1.00x faster |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pty | |
import time | |
import os | |
import termios | |
import signal | |
import sys | |
import traceback | |
import threading | |
if len(sys.argv) > 1: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# before | |
def my_decorator(f): | |
def wrapper(*args, **kwds): | |
print('Calling decorated function') | |
return f(*args, **kwds) | |
return wrapper | |
# but why not | |
def my_decorator(f)(*args, **kwds): | |
print('Calling decorated function') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Create a temporary file to store the input | |
tempfile=$(mktemp) | |
trap 'rm -f "$tempfile"' EXIT | |
# Read from stdin into the temporary file | |
cat > "$tempfile" | |
# Get the preferred editor, defaulting to vim if none is set |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
❯ 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 |
Benchmark | 2025-02-11_15-23-computed-goto-247b50dec8af | 2025-02-11_16-19-tailcall-10c138c179ba | 2025-02-11_16-15-computed-goto-nomerge-3178d094669b |
---|---|---|---|
2to3 | 295 ms | 288 ms: 1.02x faster | 293 ms: 1.01x faster |
docutils | 2.86 sec | 2.83 sec: 1.01x faster | not significant |
html5lib | 64.3 ms | 63.9 ms: 1.01x faster | 64.9 ms: 1.01x slower |
Geometric mean | (ref) | 1.01x faster | 1.00x slower |
OlderNewer