Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add fend to comparison table #662

Open
yonas opened this issue Nov 28, 2024 · 3 comments
Open

Add fend to comparison table #662

yonas opened this issue Nov 28, 2024 · 3 comments

Comments

@yonas
Copy link

yonas commented Nov 28, 2024

Add Fend to comparison table.

@yonas
Copy link
Author

yonas commented Nov 28, 2024

I noticed a performance difference. Fend is quite fast:

$ hyperfine 'echo 1 ft to cm | numbat' 'echo 1 ft to cm | fend'

Benchmark 1: echo 1 ft to cm | numbat
  Time (mean ± σ):     562.6 ms ±  47.3 ms    [User: 98.9 ms, System: 9.3 ms]
  Range (min … max):   495.2 ms … 622.7 ms    10 runs
 
Benchmark 2: echo 1 ft to cm | fend
  Time (mean ± σ):       3.4 ms ±   0.1 ms    [User: 1.9 ms, System: 2.3 ms]
  Range (min … max):     3.2 ms …   4.1 ms    572 runs
 
  Warning: Command took less than 5 ms to complete. Note that the results might be inaccurate because hyperfine can not calibrate the shell startup time much more precise than this limit. You can try to use the `-N`/`--shell=none` option to disable the shell completely.
 
Summary
  echo 1 ft to cm | fend ran
  163.32 ± 14.54 times faster than echo 1 ft to cm | numbat

@sharkdp
Copy link
Owner

sharkdp commented Jan 1, 2025

Do you use a release build of Numbat? 560 ms seems very slow. I see something like 135 ms (which is still quite slow, maybe we should investigate why the REPL is much slower than -e "…"). Also, Numbat is much faster if you use its -e "…" option:

▶ hyperfine 'numbat -e "1 ft to cm"'  
Benchmark 1: numbat -e "1 ft to cm"
  Time (mean ± σ):      33.9 ms ±   1.3 ms    [User: 25.0 ms, System: 8.8 ms]
  Range (min … max):    32.0 ms …  37.4 ms    84 runs

This is still slower then fend, but I'm not sure if that's a real-world concern. In Numbat's case, most of those 30 ms are spent parsing/type-checking/evaluating the standard library, which is written in Numbat itself. Your actual program (1 ft to cm) runs much faster than that.

However, if you have a non-toy example where Numbat is much slower than fend, please let us know.

@sharkdp sharkdp changed the title [ documentation ] Add fend to comparison table Add fend to comparison table Jan 1, 2025
@yonas
Copy link
Author

yonas commented Jan 2, 2025

Thanks @sharkdp, using -e is 6x faster than using echo on my system. 👍

Yes, I'm using a release build.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants