Skip to content

Benchmarks

Aaron Riekenberg edited this page Apr 15, 2023 · 102 revisions

Test System

  • 2017 MacBook Pro (my personal laptop)
  • 2.8 GHz Quad-Core Intel Core i7
    • 4 physical cores: hw.physicalcpu: 4
    • 2 threads per core, 8 threads total: hw.logicalcpu: 8
    • rust-parallel uses 8 parallel jobs by default on this machine
  • 16GB RAM
  • MacOS 13.3.1

1000 invocations of md5 -s using hyperfine

rust-parallel 461.3 milliseconds (31% faster than xargs, 13x faster than GNU Parallel)

$ rust-parallel -V
rust-parallel 0.5.3

$ hyperfine --warmup 3 'head -1000 /usr/share/dict/words | rust-parallel md5 -s'
Benchmark 1: head -1000 /usr/share/dict/words | rust-parallel md5 -s
  Time (mean ± σ):     461.3 ms ±   3.0 ms    [User: 893.6 ms, System: 2162.8 ms]
  Range (min … max):   457.1 ms … 465.9 ms    10 runs

xargs with 8 processes 664.3 milliseconds

$ hyperfine --warmup 3 'head -1000 /usr/share/dict/words | xargs -P8 -n1 md5 -s'
Benchmark 1: head -1000 /usr/share/dict/words | xargs -P8 -n1 md5 -s
  Time (mean ± σ):     664.3 ms ±   4.4 ms    [User: 687.7 ms, System: 1688.1 ms]
  Range (min … max):   657.5 ms … 670.2 ms    10 runs

GNU Parallel 5.980 seconds

$ parallel -V
GNU parallel 20230322

$ hyperfine --warmup 3 'head -1000 /usr/share/dict/words | parallel md5 -s'
Benchmark 1: head -1000 /usr/share/dict/words | parallel md5 -s
  Time (mean ± σ):      5.980 s ±  0.135 s    [User: 4.872 s, System: 8.113 s]
  Range (min … max):    5.723 s …  6.253 s    10 runs
Clone this wiki locally