Tags
benchmarking
3 posts
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.