Skip to content

Benchmarks

Aaron Riekenberg edited this page Jun 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

  • Run echo on 1000 strings 1 to 1000
  • Benchmarks run using hyperfine testing tool

TLDR

  • rust-parallel is 1.63x faster than xargs with 8 processes
  • rust-parallel is 13.28x faster than GNU parallel

Versions

$ rust-parallel -V
rust-parallel 1.4.0

$ parallel -V
GNU parallel 20230622

Results

$ hyperfine --warmup 3 \
  'seq 1 1000 | rust-parallel echo' \
  'seq 1 1000 | xargs -P8 -L1 echo' \
  'seq 1 1000 | parallel echo'

Benchmark 1: seq 1 1000 | rust-parallel echo
  Time (mean ± σ):     149.9 ms ±   1.0 ms    [User: 226.6 ms, System: 742.4 ms]
  Range (min … max):   148.3 ms … 152.7 ms    19 runs

Benchmark 2: seq 1 1000 | xargs -P8 -L1 echo
  Time (mean ± σ):     245.1 ms ±   1.4 ms    [User: 146.4 ms, System: 545.5 ms]
  Range (min … max):   242.6 ms … 247.0 ms    12 runs

Benchmark 3: seq 1 1000 | parallel echo
  Time (mean ± σ):      1.992 s ±  0.013 s    [User: 2.445 s, System: 3.589 s]
  Range (min … max):    1.971 s …  2.011 s    10 runs

Summary
  seq 1 1000 | rust-parallel echo ran
    1.63 ± 0.01 times faster than seq 1 1000 | xargs -P8 -L1 echo
   13.28 ± 0.12 times faster than seq 1 1000 | parallel echo
Clone this wiki locally