Why does unreached code take linear time?!?

the things I do[1]

On a debian11 VM on GCP:

mamba create -n py310 python=3.10
mamba create -n py311 python=3.11
mamba activate py310
python unreached_test.py
mamba deactivate
mamba activate py311
python unreached_test.py

outputs:

(py310) jupyter@fluent-analysis ~$ python unreached_test.py 
 142.3 ±  0.1 ns  short
 161.2 ±  0.1 ns  long

 150.4 ±  0.3 ns  short
 166.4 ±  0.1 ns  long

 150.7 ±  0.1 ns  short
 167.0 ±  0.2 ns  long

Python: 3.10.12 | packaged by conda-forge | (main, Jun 23 2023, 22:40:32) [GCC 12.3.0]

and

(py311) jupyter@fluent-analysis ~$ python unreached_test.py 
 176.8 ±  0.3 ns  short
 643.3 ±  0.4 ns  long

 176.0 ±  0.4 ns  short
 644.0 ±  0.3 ns  long

 176.5 ±  0.4 ns  short
 644.7 ±  0.6 ns  long

Python: 3.11.5 | packaged by conda-forge | (main, Aug 27 2023, 03:34:09) [GCC 12.3.0]

So this definitely is new to 3.11, although something is different in 3.10 as well…


  1. to avoid work ↩︎

1 Like