Skip to content

Benchmarks

Aaron Riekenberg edited this page Jun 18, 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.4

Test Setup

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

rust-parallel 511.8 milliseconds (30% faster than xargs, 14x faster than GNU Parallel)

$ rust-parallel -V
rust-parallel 1.3.0

$ 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 ± σ):     511.8 ms ±  14.1 ms    [User: 848.4 ms, System: 2150.1 ms]
  Range (min … max):   503.8 ms … 551.0 ms    10 runs

xargs with 8 processes 752.5 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 ± σ):     752.5 ms ±   3.8 ms    [User: 591.4 ms, System: 1586.1 ms]
  Range (min … max):   746.6 ms … 758.4 ms    10 runs

GNU Parallel 7.173 seconds

$ parallel -V
GNU parallel 20230522

$ 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 ± σ):      7.173 s ±  0.096 s    [User: 9.543 s, System: 13.324 s]
  Range (min … max):    7.029 s …  7.347 s    10 runs
Clone this wiki locally