Skip to content

Benchmarks

Aaron Riekenberg edited this page Jul 29, 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

Summary

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

Versions

$ rust-parallel -V
rust-parallel 1.6.1

$ parallel -V
GNU parallel 20230722

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.2 ms ±   0.6 ms    [User: 224.9 ms, System: 731.3 ms]
  Range (min … max):   146.1 ms … 148.7 ms    20 runs

Benchmark 2: seq 1 1000 | rust-parallel --disable-path-cache echo
  Time (mean ± σ):     209.8 ms ±   1.1 ms    [User: 254.0 ms, System: 975.7 ms]
  Range (min … max):   207.5 ms … 211.1 ms    14 runs

Benchmark 3: seq 1 1000 | xargs -P8 -L1 echo
  Time (mean ± σ):     241.5 ms ±   1.1 ms    [User: 146.2 ms, System: 533.6 ms]
  Range (min … max):   240.0 ms … 244.1 ms    12 runs

Benchmark 4: seq 1 1000 | parallel echo
  Time (mean ± σ):      1.979 s ±  0.022 s    [User: 2.441 s, System: 3.548 s]
  Range (min … max):    1.953 s …  2.028 s    10 runs

Summary
  seq 1 1000 | rust-parallel echo ran
    1.43 ± 0.01 times faster than seq 1 1000 | rust-parallel --disable-path-cache echo
    1.64 ± 0.01 times faster than seq 1 1000 | xargs -P8 -L1 echo
   13.44 ± 0.16 times faster than seq 1 1000 | parallel echo
Clone this wiki locally