sharkdp / insect

High precision scientific calculator with support for physical units
https://numbat.dev/
MIT License
3.18k stars 126 forks source link

Investigate and fix startup time increase #310

Closed triallax closed 2 years ago

triallax commented 2 years ago

https://github.com/sharkdp/insect/pull/303 caused a pretty bad regression in startup times. We should investigate why the startup time increased and how to reduce it.

triallax commented 2 years ago

I made index.js import a minified and bundled insect.js instead of output/Insect/index.js, and here are the benchmark results:

Command Mean [ms] Min [ms] Max [ms] Relative
Startup time (insect '1+1') 175.9 ± 1.7 172.2 179.5 1.00
Command Mean [ms] Min [ms] Max [ms] Relative
Startup time, stdin mode (insect < computations-1.ins) 194.9 ± 1.5 192.4 197.4 1.00
Command Mean [ms] Min [ms] Max [ms] Relative
Evaluation speed (insect < computations-160.ins) 1114.2 ± 13.1 1091.9 1131.6 1.00

Compared to master and #303 (see https://github.com/sharkdp/insect/pull/303#issuecomment-1145010004), this is a HUGE improvement.

sharkdp commented 2 years ago

Compared to master and #303 (see #303 (comment)), this is a HUGE improvement.

Oh cool!