Tags
benchmarking
6 posts
Free Threading Costs One Thread Between 0.98x and 1.37x
The quoted single-threaded overhead is 5 to 10%. Measured operation by operation on one version's two builds, it runs from nothing on an attribute write to 37% on a sum.
timeit Turns the Collector Off, and That Is Worth 2.07x
With the garbage collector disabled the cyclic implementation wins by 4%. With it enabled the same code loses by 2.07x. timeit reports the first number, always.
The Upgrade Halved Four Numbers and Made Three Worse
From 3.10 to 3.15, reads and calls land at 0.46x to 0.54x. A coroutine object is 1.79x bigger, get_type_hints is 1.40x slower and importing asyncio costs 1.40x more.
cProfile Slowed It 2.9x and Moved the Ranking by One Point
cProfile adds a flat 25 to 30 ns to every call it observes. That inflates a 47 ns function's reported time by 1.57x and a one-microsecond function's by nothing at all.
UTF-8 by Default Fixes a Silent Bug and Adds a Loud One
Under a Latin-1 locale, CPython 3.13 reads a UTF-8 file as mojibake and raises nothing. 3.15 reads it correctly and raises on the Latin-1 file 3.13 read fine.
Slots Did Not Get Slower, One Build Did
A read through __slots__ costs 24% more than one through an instance dictionary on CPython 3.13.2. Rebuild the same version and the gap goes away.