Skip to content

Benchmarks

Aaron Riekenberg edited this page Aug 6, 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.42 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.29 times faster than GNU parallel

Versions

$ rust-parallel -V
rust-parallel 1.6.2

$ 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 ± σ):     149.3 ms ±   0.7 ms    [User: 226.2 ms, System: 743.0 ms]
  Range (min … max):   148.4 ms … 151.0 ms    19 runs

Benchmark 2: seq 1 1000 | rust-parallel --disable-path-cache echo
  Time (mean ± σ):     212.6 ms ±   1.1 ms    [User: 254.8 ms, System: 988.6 ms]
  Range (min … max):   210.7 ms … 214.9 ms    14 runs

Benchmark 3: seq 1 1000 | xargs -P8 -L1 echo
  Time (mean ± σ):     245.9 ms ±   1.3 ms    [User: 146.5 ms, System: 544.9 ms]
  Range (min … max):   243.9 ms … 247.7 ms    12 runs

Benchmark 4: seq 1 1000 | parallel echo
  Time (mean ± σ):      1.984 s ±  0.014 s    [User: 2.439 s, System: 3.556 s]
  Range (min … max):    1.968 s …  2.018 s    10 runs

Summary
  seq 1 1000 | rust-parallel echo ran
    1.42 ± 0.01 times faster than seq 1 1000 | rust-parallel --disable-path-cache echo
    1.65 ± 0.01 times faster than seq 1 1000 | xargs -P8 -L1 echo
   13.29 ± 0.12 times faster than seq 1 1000 | parallel echo
Clone this wiki locally