I am now directly comparing the main branch with my fast-import branch (located at $FASTAIIDA), by running hyperfine like this
hyperfine "PYTHONPATH=$FASTAIIDA python -c 'import aiida'" "python -c 'import aiida'"
import aiida
3.58 ± 0.23 times faster
Benchmark 1: PYTHONPATH=/tmp/faster-import python -c 'import aiida'
Time (mean ± Ļ): 77.3 ms ± 4.0 ms [User: 67.4 ms, System: 9.7 ms]
Range (min ⦠max): 54.1 ms ⦠80.0 ms 39 runs
Benchmark 2: python -c 'import aiida'
Time (mean ± Ļ): 276.9 ms ± 10.4 ms [User: 247.1 ms, System: 29.1 ms]
Range (min ⦠max): 257.5 ms ⦠291.4 ms 10 runs
Summary
'PYTHONPATH=/tmp/faster-import python -c 'import aiida'' ran
3.58 ± 0.23 times faster than 'python -c 'import aiida''
import aiida.cmdline.commands (verdi)
1.92 ± 0.13 times faster
Benchmark 1: PYTHONPATH=/tmp/faster-import python -c 'import aiida.cmdline.commands'
Time (mean ± Ļ): 162.8 ms ± 8.9 ms [User: 142.4 ms, System: 18.9 ms]
Range (min ⦠max): 140.0 ms ⦠186.4 ms 18 runs
Benchmark 2: python -c 'import aiida.cmdline.commands'
Time (mean ± Ļ): 312.9 ms ± 12.6 ms [User: 281.9 ms, System: 30.6 ms]
Range (min ⦠max): 297.9 ms ⦠333.4 ms 10 runs
Summary
'PYTHONPATH=/tmp/faster-import python -c 'import aiida.cmdline.commands'' ran
1.92 ± 0.13 times faster than 'python -c 'import aiida.cmdline.commands''
import aiida.transports
2.75 ± 0.22 times faster
Time (mean ± Ļ): 129.2 ms ± 10.1 ms [User: 109.3 ms, System: 19.3 ms]
Range (min ⦠max): 108.7 ms ⦠136.2 ms 21 runs
Benchmark 2: python -c 'import aiida.transports'
Time (mean ± Ļ): 355.4 ms ± 2.6 ms [User: 316.4 ms, System: 38.3 ms]
Range (min ⦠max): 352.0 ms ⦠359.5 ms 10 runs
Summary
'PYTHONPATH=/tmp/faster-import python -c 'import aiida.transports'' ran
2.75 ± 0.22 times faster than 'python -c 'import aiida.transports''
import aiida.orm
4.13 ± 0.62 times faster
Benchmark 1: PYTHONPATH=/tmp/faster-import python -c 'import aiida.orm'
Time (mean ± Ļ): 207.0 ms ± 13.0 ms [User: 181.9 ms, System: 22.0 ms]
Range (min ⦠max): 199.1 ms ⦠251.0 ms 14 runs
Warning: Statistical outliers were detected. Consider re-running this benchmark on a quiet system without any interferences from other programs. It might help to use the '--warmup' or '--prepare' options.
Benchmark 2: python -c 'import aiida.orm'
Time (mean ± Ļ): 854.9 ms ± 117.5 ms [User: 1687.1 ms, System: 3095.8 ms]
Range (min ⦠max): 706.9 ms ⦠1063.5 ms 10 runs
Summary
'PYTHONPATH=/tmp/faster-import python -c 'import aiida.orm'' ran
4.13 ± 0.62 times faster than 'python -c 'import aiida.orm''
import aiida.engine
4.03 ± 0.50 times faster
Benchmark 1: PYTHONPATH=/tmp/faster-import python -c 'import aiida.engine'
Time (mean ± Ļ): 234.6 ms ± 7.4 ms [User: 211.2 ms, System: 23.2 ms]
Range (min ⦠max): 213.8 ms ⦠243.2 ms 12 runs
Benchmark 2: python -c 'import aiida.engine'
Time (mean ± Ļ): 944.8 ms ± 113.9 ms [User: 1756.5 ms, System: 3128.3 ms]
Range (min ⦠max): 775.2 ms ⦠1177.7 ms 10 runs
Summary
'PYTHONPATH=/tmp/faster-import python -c 'import aiida.engine'' ran
4.03 ± 0.50 times faster than 'python -c 'import aiida.engine''
importing everything together
Benchmark 1: PYTHONPATH=/tmp/faster-import python -c 'import aiida.engine;import aiida.cmdline.commands;import aiida.transports'
Time (mean ± Ļ): 306.5 ms ± 12.8 ms [User: 276.0 ms, System: 29.9 ms]
Range (min ⦠max): 293.9 ms ⦠329.9 ms 10 runs
Benchmark 2: python -c 'import aiida.engine;import aiida.cmdline.commands;import aiida.transports'
Time (mean ± Ļ): 988.0 ms ± 109.8 ms [User: 1804.0 ms, System: 3157.6 ms]
Range (min ⦠max): 846.4 ms ⦠1145.6 ms 10 runs
Summary
'PYTHONPATH=/tmp/faster-import python -c 'import aiida.engine;import aiida.cmdline.commands;import aiida.transports'' ran
3.22 ± 0.38 times faster than 'python -c 'import aiida.engine;import aiida.cmdline.commands;import aiida.transports''