3 ms·
It's this really nice combination of bash, curl, and libraries for JSON, CSV, ZIP files, and almost everything else you could need. Full list at [0]. You can a
by the-alchemist 4y ago
It's this really nice combination of bash, curl, and libraries for JSON, CSV, ZIP files, and almost everything else you could need. Full list at [0]. You can always spawn a shell too.
It starts just as fast as Python too, if not faster, at least on my machine:
time python3 -c 'import os.path; print(os.path.exists("README.md"))'
time bb -e '(.exists (new java.io.File "README.md"))'
Python averages around 40-50ms, and bb averages 30-40ms.
[0]: https://book.babashka.org/#built-in-namespaces https://book.babashka.org/#built-in-namespaces
- 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).