Skip to content

Benchmarks

Aaron Riekenberg edited this page Apr 29, 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 470.2 milliseconds (30% faster than xargs, 13x faster than GNU Parallel)

$ rust-parallel -V
rust-parallel 0.6.2

$ 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 ± σ):     470.2 ms ±   3.8 ms    [User: 900.8 ms, System: 2248.7 ms]
  Range (min … max):   464.5 ms … 477.4 ms    10 runs

xargs with 8 processes 667.8 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 ± σ):     667.8 ms ±   3.3 ms    [User: 690.5 ms, System: 1704.7 ms]
  Range (min … max):   662.0 ms … 671.6 ms    10 runs

GNU Parallel 6.114 seconds

$ parallel -V
GNU parallel 20230422

$ 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 ± σ):      6.114 s ±  0.173 s    [User: 4.968 s, System: 8.430 s]
  Range (min … max):    5.930 s …  6.435 s    10 runs
Clone this wiki locally