Skip to content

Benchmarks

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

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.50 times faster than GNU parallel

Versions

$ rust-parallel -V
rust-parallel 1.10.4

$ parallel -V
GNU parallel 20231022

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.4 ms ±   0.8 ms    [User: 225.4 ms, System: 739.0 ms]
  Range (min … max):   146.4 ms … 148.8 ms    19 runs

Benchmark 2: seq 1 1000 | rust-parallel --disable-path-cache echo
  Time (mean ± σ):     210.7 ms ±   1.5 ms    [User: 255.2 ms, System: 985.6 ms]
  Range (min … max):   208.1 ms … 215.0 ms    14 runs

Benchmark 3: seq 1 1000 | xargs -P8 -L1 echo
  Time (mean ± σ):     242.3 ms ±   1.2 ms    [User: 145.7 ms, System: 541.5 ms]
  Range (min … max):   240.2 ms … 243.7 ms    12 runs

Benchmark 4: seq 1 1000 | parallel echo
  Time (mean ± σ):      1.991 s ±  0.018 s    [User: 2.445 s, System: 3.586 s]
  Range (min … max):    1.970 s …  2.037 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.50 ± 0.14 times faster than seq 1 1000 | parallel echo
Clone this wiki locally