Skip to content

Benchmarks ⚡️

Performance is a core feature of Mago. Every component, from the parser to the analyzer, is designed to be as fast as possible.

We regularly benchmark Mago against other popular tools in the PHP ecosystem to ensure it remains the fastest toolchain available. The benchmarks below were run against the full wordpress-develop codebase.

Our Performance Promise

At its core, Mago is built on a simple philosophy: it must be the fastest.

This is not just a goal; it's a guarantee. If any tool listed in our benchmarks ever outperforms Mago in a like-for-like comparison, we consider it a high-priority bug that needs to be fixed. Speed is a feature, and we promise to always deliver it.

Formatter

This benchmark measures the time it takes to check the formatting of an entire codebase.

Speed

ToolTime (mean ± σ)Relative Speed
Mago362.3ms ± 4.6ms1x
Pretty PHP35.62s ± 0.06s98.32x slower

Resource Usage

ToolPeak Memory (RSS)CPU Cycles
Mago582 MB~9.4 Million
Pretty PHP159 MB~10.4 Million

Linter

This benchmark measures the time it takes to lint an entire codebase.

Speed

ToolTime (mean ± σ)Relative Speed
Mago745.8ms ± 7.1ms1x
Pint34.23s ± 0.05s45.89x slower
PHP-CS-Fixer41.81s ± 0.13s56.07x slower

Resource Usage

ToolPeak Memory (RSS)CPU Cycles
Mago541 MB~9.2 Million
Pint74 MB~9.8 Million
PHP-CS-Fixer77 MB~9.8 Million

Analyzer

This benchmark measures the time it takes to perform a full static analysis.

Speed

ToolTime (mean ± σ)Relative Speed
Mago3.86s ± 0.15s1x
Psalm45.42s ± 1.16s11.77x slower
PHPStan111.43s ± 0.45s28.88x slower

Resource Usage

ToolPeak Memory (RSS)CPU Cycles
Mago1.36 GB~9.8 Million
Psalm1.52 GB~9.9 Million
PHPStan865 MB~11.5 Million

Environment

  • Codebase: wordpress-develop@5b01d24
  • Hardware: MacBook Pro (Apple M1 Pro, 32GB RAM)
  • PHP: 8.4.11 (Zend v4.4.11, Zend OPcache v8.4.11)

A Note on Memory Usage

You might notice that Mago sometimes uses more memory than other tools, especially on large codebases. This is a deliberate and fundamental design choice.

Mago prioritizes your time over machine resources.

To achieve its blazing-fast speeds, Mago uses a per-thread arena allocators. Instead of asking the operating system for memory for every little object (which is slow), it reserves large chunks of memory upfront and then allocates objects within that arena with near-zero cost. The trade-off is that this can lead to a higher peak memory footprint. We believe that in modern development environments, saving a developer several seconds—or even minutes—is a worthwhile trade for a temporary increase in RAM usage.