Skip to content

Benchmarks

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

$ rust-parallel -V
rust-parallel 1.1.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 ± σ):     444.8 ms ±   5.2 ms    [User: 821.1 ms, System: 2084.1 ms]
  Range (min … max):   439.2 ms … 452.4 ms    10 runs

xargs with 8 processes 643.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 ± σ):     643.8 ms ±   4.2 ms    [User: 678.9 ms, System: 1650.6 ms]
  Range (min … max):   637.8 ms … 650.0 ms    10 runs

GNU Parallel 5.971 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 ± σ):      5.971 s ±  0.116 s    [User: 4.840 s, System: 8.012 s]
  Range (min … max):    5.805 s …  6.154 s    10 runs
Clone this wiki locally