Skip to content

Benchmarks ​

These are timings of prefix for Strauss PHP and Strauss-RS on four projects of different sizes. They were taken on one machine, so treat them as a guide to the size of the difference. Your results will vary with your hardware, your project and your disk.

Results ​

Each time is the median of several runs: seven for the small and medium projects, three for the large and extra large ones.

ProjectWorkersStrauss PHPStrauss-RSSpeedupPHP peak memoryRS peak memory
small1625.4 ms22.8 ms27.4x70 MiB9.5 MiB
small12831.3 ms9.1 ms91.0x411 MiB11.7 MiB
medium11.11 s46.5 ms24.0x83 MiB13.1 MiB
medium121.38 s16.2 ms85.5x599 MiB19.5 MiB
large118.72 s761.3 ms24.6x259 MiB81.6 MiB
large1216.84 s188.7 ms89.3x1,291 MiB97.7 MiB
xlarge142.26 s1.50 s28.2x990 MiB336.2 MiB
xlarge1255.05 s395.6 ms139.1x5,556 MiB405.4 MiB
  • Small: monolog
  • Medium: guzzle + flysystem + finder
  • Large: laravel/framework
  • X-Large: aws-sdk-php

How they were run ​

  • Wall time for prefix command
  • Median of 5 runs after 1 warm-up, from a clean output directory each time.
  • Both tools were given the worker count explicitly (1 against 1, 12 against 12).
  • Memory is peak total across all processes, sampled on Linux.
  • Strauss PHP 0.31.1 on PHP 8.4.23 (static CLI build, no OPcache, no memory limit).
  • Strauss-RS release build.
  • Intel i5-10600 (12 threads), 32 GB RAM.
  • All projects with locked dependencies.

What to keep in mind ​

  • These measure the prefix step. A Composer install and your own build steps take the same time with either tool.

How to reproduce benchmarks ​

Clone the repo from GitHub, then run the following commands

sh
cargo run --release --features benchmark -- benchmark setup
cargo run --release --features benchmark -- benchmark run

Setup downloads the pinned Strauss PHP 0.31.1 phar and runs composer install for each project. run has these options:

OptionDescription
--project <NAME>Only run this project. Can be given more than once. By default every project in benchmark.json is run.
--tool <rs|php>Only run this tool. Can be given more than once. By default both are run.
--runs <N>How many timed runs of each. The default is 5.
--warmup <N>How many runs to throw away first. The default is 1.
--workers <N>How many workers in the runs with many. Must be 2 or more. The default is one per CPU.
--php <PATH>The PHP binary that runs Strauss PHP and checks the output. The default is php from your PATH.
--json <FILE>Write the results, and what they were measured on, to this JSON file.
--keepLeave the last output in place, instead of deleting it.
--no-checkDon't parse the output with PHP.
--no-tree-memoryDon't take the extra run that adds up the memory of every process.
--allow-debugRun even though this is a debug build. The times mean nothing in a debug build.

Released under the MIT licence. Strauss-RS is based on Strauss by Brian Henry.