Skip to content

Benchmarks

Aaron Riekenberg edited this page Jan 7, 2024 · 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 14.2.1

Test Setup

Summary

  • rust-parallel is 1.41 times faster when the path cache is enabled (this is enabled by default)
  • rust-parallel is 2.11 times faster than xargs with 8 processes. Note that this use of xargs does not prevent output interleaving.
  • rust-parallel is 12.02 times faster than GNU parallel

Versions

$ rust-parallel -V
rust-parallel 1.13.0

$ parallel -V
GNU parallel 20231222

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 ± σ):     163.6 ms ±   0.9 ms    [User: 216.7 ms, System: 594.0 ms]
  Range (min … max):   161.7 ms … 165.6 ms    18 runs

Benchmark 2: seq 1 1000 | rust-parallel --disable-path-cache echo
  Time (mean ± σ):     230.1 ms ±   0.9 ms    [User: 259.2 ms, System: 886.9 ms]
  Range (min … max):   228.9 ms … 232.0 ms    12 runs

Benchmark 3: seq 1 1000 | xargs -P8 -L1 echo
  Time (mean ± σ):     345.8 ms ±   3.1 ms    [User: 153.8 ms, System: 513.0 ms]
  Range (min … max):   342.4 ms … 353.1 ms    10 runs

Benchmark 4: seq 1 1000 | parallel echo
  Time (mean ± σ):      1.966 s ±  0.015 s    [User: 2.546 s, System: 3.454 s]
  Range (min … max):    1.953 s …  2.004 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
    2.11 ± 0.02 times faster than seq 1 1000 | xargs -P8 -L1 echo
   12.02 ± 0.11 times faster than seq 1 1000 | parallel echo
Clone this wiki locally