Skip to content

Benchmarks

Aaron Riekenberg edited this page Sep 17, 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.5

Test Setup

Summary

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

Versions

$ rust-parallel -V
rust-parallel 1.10.0

$ parallel -V
GNU parallel 20230822

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 ± σ):     151.5 ms ±   1.0 ms    [User: 227.6 ms, System: 748.7 ms]
  Range (min … max):   149.9 ms … 153.6 ms    19 runs

Benchmark 2: seq 1 1000 | rust-parallel --disable-path-cache echo
  Time (mean ± σ):     214.0 ms ±   1.0 ms    [User: 256.8 ms, System: 994.5 ms]
  Range (min … max):   212.1 ms … 216.2 ms    13 runs

Benchmark 3: seq 1 1000 | xargs -P8 -L1 echo
  Time (mean ± σ):     246.9 ms ±   1.8 ms    [User: 146.7 ms, System: 546.0 ms]
  Range (min … max):   243.5 ms … 249.0 ms    12 runs

Benchmark 4: seq 1 1000 | parallel echo
  Time (mean ± σ):      2.012 s ±  0.008 s    [User: 2.458 s, System: 3.608 s]
  Range (min … max):    2.003 s …  2.028 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.63 ± 0.02 times faster than seq 1 1000 | xargs -P8 -L1 echo
   13.28 ± 0.10 times faster than seq 1 1000 | parallel echo
Clone this wiki locally