sharkdp / insect

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

Move from test-unit to spec #384

Closed triallax closed 1 year ago

triallax commented 1 year ago

The migration is rather straightforward, but it brings a HUGE decrease in the time required to run tests as determined by hyperfine --warmup 2 'npm test'. Before:

Benchmark 1: npm test
  Time (mean ± σ):     71.245 s ±  0.619 s    [User: 75.323 s, System: 0.868 s]
  Range (min … max):   70.245 s … 72.363 s    10 runs

After:

Benchmark 1: npm test
  Time (mean ± σ):     18.666 s ±  0.256 s    [User: 22.082 s, System: 0.671 s]
  Range (min … max):   18.327 s … 19.048 s    10 runs

I'm also considering moving to assert instead, but it's much lower-level than the other two, so I'm not too sure about that. It could be worth a try though.

sharkdp commented 1 year ago

This is awesome, thank you very much

triallax commented 1 year ago

@sharkdp you're welcome.

I'm trying to merge "uncontroversial" PRs on my own initiative instead of waiting for your review. I hope that's fine with you?

sharkdp commented 1 year ago

Yes, that is completely fine