thejcannon
(Josh Cannon)
122
Why not just use module __getattr__? Am I missing something?
Interpreter baseline:
hyperfine './bin/python3.14 -c "pass"' --warmup 10
Benchmark 1: ./bin/python3.14 -c "pass"
Time (mean ± σ): 5.3 ms ± 0.2 ms [User: 4.8 ms, System: 0.7 ms]
Range (min … max): 5.2 ms … 7.5 ms 512 runs
Importing typing for TYPE_CHECKING
hyperfine './bin/python3.14 -c "from typing import TYPE_CHECKING"' --warmup 10
Benchmark 1: ./bin/python3.14 -c "from typing import TYPE_CHECKING"
Time (mean ± σ): 11.4 ms ± 0.4 ms [User: 10.6 ms, System: 0.8 ms]
Range (min … max): 11.1 ms … 15.3 ms 245 runs
After this change:
hyperfine './bin/python3.14 -c "from typing import TYPE_CHECKING"' --warmup 10
Benchmark 1: ./bin/python3.14 -c "from typing import TYPE_CHECKING"
Time (mean ± σ): 5.2 ms ± 0.2 ms [User: 4.8 ms, System: 0.6 ms]
Range (min … max): 5.1 ms … 7.4 ms 479 runs
3 Likes