Skip to content

Benchmarks

Aaron Riekenberg edited this page Apr 22, 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

Test Setup

  • Run md5 -s on first 1000 words from /usr/share/dict/words
  • Benchmarks run using hyperfine testing tool

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

$ rust-parallel -V
rust-parallel 0.6.1

$ 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 ± σ):     452.8 ms ±   1.6 ms    [User: 877.4 ms, System: 2183.7 ms]
  Range (min … max):   450.0 ms … 454.7 ms    10 runs

xargs with 8 processes 658.1 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 ± σ):     658.1 ms ±  10.2 ms    [User: 684.8 ms, System: 1689.7 ms]
  Range (min … max):   650.4 ms … 685.8 ms    10 runs

GNU Parallel 5.916 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.916 s ±  0.154 s    [User: 4.795 s, System: 8.043 s]
  Range (min … max):    5.783 s …  6.190 s    10 runs
Clone this wiki locally