Skip to content

Benchmarks

Aaron Riekenberg edited this page Jul 1, 2023 · 102 revisions

Test System

  • 15-inch Macbook Air M2, 2023 (my personal laptop)
  • rust-parallel uses 8 parallel jobs by default on this machine
  • MacOS 13.4.1

Test Setup

TLDR

  • rust-parallel is 1.41x faster with the path cache is enabled (this is enabled by default)
  • rust-parallel is 1.64x faster than xargs with 8 processes
  • rust-parallel is 13.89x faster than GNU parallel

Versions

$ rust-parallel -V
rust-parallel 1.4.1

$ parallel -V
GNU parallel 20230622

Results

$ hyperfine --warmup 3 \
  'seq 1 1000 | rust-parallel echo' \
  'seq 1 1000 | rust-parallel --disable-path-cache echo' \
  'seq 1 1000 | xargs -P8 -L1 echo' \
  'seq 1 1000 | parallel echo'

Benchmark 1: seq 1 1000 | rust-parallel echo
  Time (mean ± σ):     147.9 ms ±   0.7 ms    [User: 224.7 ms, System: 735.2 ms]
  Range (min … max):   146.7 ms … 149.2 ms    20 runs

Benchmark 2: seq 1 1000 | rust-parallel --disable-path-cache echo
  Time (mean ± σ):     209.1 ms ±   1.0 ms    [User: 252.4 ms, System: 983.0 ms]
  Range (min … max):   207.3 ms … 210.5 ms    14 runs

Benchmark 3: seq 1 1000 | xargs -P8 -L1 echo
  Time (mean ± σ):     243.1 ms ±   3.0 ms    [User: 146.4 ms, System: 540.8 ms]
  Range (min … max):   240.7 ms … 252.0 ms    12 runs

Benchmark 4: seq 1 1000 | parallel echo
  Time (mean ± σ):      2.055 s ±  0.107 s    [User: 2.466 s, System: 3.676 s]
  Range (min … max):    1.973 s …  2.337 s    10 runs

Summary
  seq 1 1000 | rust-parallel echo ran
    1.41 ± 0.01 times faster than seq 1 1000 | rust-parallel --disable-path-cache echo
    1.64 ± 0.02 times faster than seq 1 1000 | xargs -P8 -L1 echo
   13.89 ± 0.73 times faster than seq 1 1000 | parallel echo
Clone this wiki locally