4 ms·
> Python averages around 40-50ms, and bb averages 30-40ms. Sounds like you have a slow harddrive here, rather than measuring the startup of the interpreters.
by capableweb 4y ago
> Python averages around 40-50ms, and bb averages 30-40ms.
Sounds like you have a slow harddrive here, rather than measuring the startup of the interpreters.
With hyperfine:
$ hyperfine --warmup=100 --runs=1000 'python3 -c "import os.path; print(os.path.exists('"'README.md'"'))"' 'bb -e '"'(.exists (new java.io.File "'"README.md"'"))'"''
Benchmark 1: python3 -c "import os.path; print(os.path.exists('README.md'))"
Time (mean ± σ): 5.3 ms ± 0.7 ms [User: 4.9 ms, System: 1.2 ms]
Range (min … max): 4.5 ms … 9.8 ms 1000 runs
Benchmark 2: bb -e '(.exists (new java.io.File "README.md"))'
Time (mean ± σ): 6.0 ms ± 2.5 ms [User: 2.5 ms, System: 4.3 ms]
Range (min … max): 0.4 ms … 10.6 ms 1000 runs
Summary
'python3 -c "import os.path; print(os.path.exists('README.md'))"' ran
1.12 ± 0.49 times faster than 'bb -e '(.exists (new java.io.File "README.md"))''
Running on the following "not absolutely shabby" specs:
> Intel i7-1185G7, 6.0.11-arch, Toshiba NVMe SSD (KBG40ZNS256G)
Seems Python has more consistent startup performance (`4.5 ms … 9.8 ms`) while Babashka can startup faster (`0.4 ms … 10.6 ms`) but on average, Python startups faster.
- __jem 4y agobb is 1.32 ± 0.08 times faster on my computer (m1 mbp).