Skip to content

Benchmarks

Aaron Riekenberg edited this page Dec 22, 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 14.2

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 11.89 times faster than GNU parallel

Versions

$ rust-parallel -V
rust-parallel 1.12.0

$ parallel -V
GNU parallel 20231122

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 ±   1.4 ms    [User: 215.8 ms, System: 600.5 ms]
  Range (min … max):   160.9 ms … 166.2 ms    18 runs

Benchmark 2: seq 1 1000 | rust-parallel --disable-path-cache echo
  Time (mean ± σ):     230.5 ms ±   1.7 ms    [User: 256.1 ms, System: 892.1 ms]
  Range (min … max):   227.4 ms … 233.8 ms    12 runs

Benchmark 3: seq 1 1000 | xargs -P8 -L1 echo
  Time (mean ± σ):     344.7 ms ±   0.9 ms    [User: 153.4 ms, System: 517.3 ms]
  Range (min … max):   343.9 ms … 347.0 ms    10 runs

Benchmark 4: seq 1 1000 | parallel echo
  Time (mean ± σ):      1.945 s ±  0.010 s    [User: 2.543 s, System: 3.462 s]
  Range (min … max):    1.929 s …  1.956 s    10 runs

Summary
  seq 1 1000 | rust-parallel echo ran
    1.41 ± 0.02 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
   11.89 ± 0.12 times faster than seq 1 1000 | parallel echo
Clone this wiki locally