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.45 times faster when the path cache is enabled (this is enabled by default)
  • rust-parallel is 1.60 times faster than xargs with 8 processes
  • rust-parallel is 13.06 times faster than GNU parallel

Versions

$ rust-parallel -V
rust-parallel 1.4.2

$ 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 ± σ):     152.8 ms ±   2.7 ms    [User: 224.4 ms, System: 741.9 ms]
  Range (min … max):   150.5 ms … 161.6 ms    19 runs

Benchmark 2: seq 1 1000 | rust-parallel --disable-path-cache echo
  Time (mean ± σ):     220.8 ms ±  10.1 ms    [User: 249.9 ms, System: 974.6 ms]
  Range (min … max):   212.6 ms … 251.1 ms    13 runs

Benchmark 3: seq 1 1000 | xargs -P8 -L1 echo
  Time (mean ± σ):     244.7 ms ±   1.3 ms    [User: 146.7 ms, System: 546.9 ms]
  Range (min … max):   243.1 ms … 247.6 ms    12 runs

Benchmark 4: seq 1 1000 | parallel echo
  Time (mean ± σ):      1.996 s ±  0.012 s    [User: 2.435 s, System: 3.594 s]
  Range (min … max):    1.978 s …  2.015 s    10 runs

Summary
  seq 1 1000 | rust-parallel echo ran
    1.45 ± 0.07 times faster than seq 1 1000 | rust-parallel --disable-path-cache echo
    1.60 ± 0.03 times faster than seq 1 1000 | xargs -P8 -L1 echo
   13.06 ± 0.25 times faster than seq 1 1000 | parallel echo
Clone this wiki locally