Skip to content

Benchmarks

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

Versions

$ rust-parallel -V
rust-parallel 1.8.3

$ 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 ± σ):     148.7 ms ±   0.7 ms    [User: 225.8 ms, System: 743.5 ms]
  Range (min … max):   147.7 ms … 150.3 ms    20 runs

Benchmark 2: seq 1 1000 | rust-parallel --disable-path-cache echo
  Time (mean ± σ):     211.9 ms ±   1.1 ms    [User: 253.9 ms, System: 991.3 ms]
  Range (min … max):   209.9 ms … 213.9 ms    14 runs

Benchmark 3: seq 1 1000 | xargs -P8 -L1 echo
  Time (mean ± σ):     244.4 ms ±   2.4 ms    [User: 145.7 ms, System: 547.4 ms]
  Range (min … max):   242.2 ms … 251.3 ms    12 runs

Benchmark 4: seq 1 1000 | parallel echo
  Time (mean ± σ):      1.991 s ±  0.010 s    [User: 2.444 s, System: 3.593 s]
  Range (min … max):    1.974 s …  2.007 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.64 ± 0.02 times faster than seq 1 1000 | xargs -P8 -L1 echo
   13.39 ± 0.10 times faster than seq 1 1000 | parallel echo
Clone this wiki locally