analysis of performance characteristics in Python's experimental free-threading support (PEP 703) for Python 3.13+.
- Thread Concepts (thread affinity, ref counting, false sharing and specialization)
- Memory Barriers (memory ordering, false sharing and padded memory)
- PEP 703: Making the GIL Optional
- Free Threading HOWTO
Establish baseline performance metrics:
Memory Ordering:
Reference Counting:
Runners:
-
Github actions runner:
- CPU: 4 cores @ 2923.43 MHz
- CPU affinity: All 4 cores
- Memory: 15.61 GB
- OS: Linux 6.5.0-1025-azure
-
Local machine:
- CPU: 20 cores @ 2022.67 MHz (Intel i7-14700K)
- CPU affinity: 2-7 (6 isolated P-cores, refer to this article for details on isolation and cpu-pinning)
- Memory: 62.57 GB
- OS: Linux 6.8.0-47-generic
# Run all tests
python benchmark_runner.py
# Run specific category
python benchmark_runner.py --benchmarks memory/ordering/*
# Run with profiling
python benchmark_runner.py --profile detailed
- Linux kernel 5.10+
- Python versions:
- 3.12.7 (baseline)
- 3.13.0 (with GIL)
- 3.13.0t (no GIL)
study more after the following areas are addressed in Python 3.14+:
- Re-enabling specializing adaptive interpreter
- Reduced immortalization scope
- Improved thread-safety mechanisms
- Better memory usage patterns