Skip to content

Benchmarks

Aaron Riekenberg edited this page Sep 24, 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.46 times faster when the path cache is enabled (this is enabled by default)
  • rust-parallel is 1.65 times faster than xargs with 8 processes. Note that this use of xargs does not prevent output interleaving.
  • rust-parallel is 13.18 times faster than GNU parallel

Versions

$ rust-parallel -V
rust-parallel 1.10.2

$ 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 ± σ):     152.2 ms ±   1.3 ms    [User: 229.7 ms, System: 759.8 ms]
  Range (min … max):   150.0 ms … 154.7 ms    19 runs

Benchmark 2: seq 1 1000 | rust-parallel --disable-path-cache echo
  Time (mean ± σ):     222.8 ms ±   1.2 ms    [User: 258.7 ms, System: 1047.5 ms]
  Range (min … max):   220.7 ms … 224.7 ms    13 runs

Benchmark 3: seq 1 1000 | xargs -P8 -L1 echo
  Time (mean ± σ):     250.6 ms ±   1.0 ms    [User: 146.9 ms, System: 555.1 ms]
  Range (min … max):   249.2 ms … 253.0 ms    11 runs

Benchmark 4: seq 1 1000 | parallel echo
  Time (mean ± σ):      2.006 s ±  0.015 s    [User: 2.465 s, System: 3.609 s]
  Range (min … max):    1.992 s …  2.038 s    10 runs

Summary
  seq 1 1000 | rust-parallel echo ran
    1.46 ± 0.01 times faster than seq 1 1000 | rust-parallel --disable-path-cache echo
    1.65 ± 0.02 times faster than seq 1 1000 | xargs -P8 -L1 echo
   13.18 ± 0.15 times faster than seq 1 1000 | parallel echo
Clone this wiki locally