Hacker News new | ask | show | jobs
by Tuna-Fish 2227 days ago
And just to help the lazy people, after making the benchmarked loads equivalent, the results are:

hyperfine go/out 'node javascript/main.js' rust/target/release/rust 1 Benchmark #1: go/out

  Time (mean ± σ):      1.888 s ±  0.013 s    [User: 2.040 s, System: 0.045 s]

  Range (min … max):    1.875 s …  1.918 s    10 runs
Benchmark #2: node javascript/main.js

  Time (mean ± σ):      4.257 s ±  0.033 s    [User: 4.295 s, System: 0.042 s]

  Range (min … max):    4.221 s …  4.338 s    10 runs
Benchmark #3: rust/target/release/rust

  Time (mean ± σ):     874.1 ms ±  50.8 ms    [User: 5.688 s, System: 0.830 s]

  Range (min … max):   813.5 ms … 1001.9 ms    10 runs
Summary

  'rust/target/release/rust' ran

    2.16 ± 0.13 times faster than 'go/out'

    4.87 ± 0.29 times faster than 'node javascript/main.js'
2 comments

It looks like you got that from this PR: https://github.com/christianscott/levenshtein-distance-bench...

That PR does not make the benchmark loads "equivalent." Please look at the diff. That PR adds parallelism to the Rust program. The Go program does not have parallelism.

The Go and Rust program in that benchmark are really not equivalent. Rust is using threads.