Performance of Composer 2.0 with PHP 8 JIT

Performance of Composer 2.0 with PHP 8 JIT

It's been an exciting few months for PHP developers. With the arrival of Composer 2.0 and PHP 8.0 there has been a significant updates to the foundations for Ibexa DXP and numerous other software projects powered by PHP. To continue on the benchmark themes of benchmarking Composer 1.10 and 2.0 and Symfony 5.2 with PHP 7.1 and 8.0,  we'll take a look at performance of Composer 2.0 on PHP 8.0.

Similar to the earlier articles, I ran benchmarks on a Hetzner CCX11 VPS with 2 dedicated vCPU and 8 GB of RAM. I tested three scenarios using Composer 2.0.7:

I chose not to enable OPcache Preloading because of just running Composer a few times would likeny not benefit from it. The OPCache and JIT configuration(s) used:



# only when JIT was enabled

The benchmark round included the following with an Ibexa Experience installation:

  1. Install without a lock file and purged caches
  2. Require a new package (novactive/ezseobundle)
  3. Install with lock file, with purged caches
  4. Install with lock file, with filled caches

I ran this set three times with similar scripts to from before and cherry-picked the best number for each. I measured the time and memory usage for reporting.

Composer install time PHP 7.4 & PHP 8.0 (+JIT)

Regarding the duration of installation there are no great changes. With full dependency resolving is quickest with PHP 7.4 and slowest with PHP 8.0 JIT, for installation with a lock file but an empty cache non-JIT PHP 8.0 is the slowest. For cached results are identical, at just 6 seconds it's great for integrated CI/CD pipelines.

Composer memory usage PHP 7.4 & PHP 8.0 (+JIT)

For memory usage the story is even closer. PHP 8 is the most frugal with a full dependency resolve, but slightly more wasteful in the other scenarios. The differences here are quite small and thus are not very meaningful in real-world scenarios.

Based on the testing there is not much benefit for Composer when using PHP 8.0 (with or without JIT) over PHP 7.4. For more meaningful improvements I would recommend looking at upgrading from Composer 1 to Composer 2. Especially the reduced memory footprint for dependency resolving is very significant.

Feedback welcome on Discourse: Performance of Composer 2.0 with PHP 8 JIT

Photo by Javier García on Unsplash

Insights and News

By Jani Tarvainen
13/01/2022 | 3 Min read
By Tomasz Dabrowski
26/08/2021 | 3 Min read
By Mateusz Bieniek
12/03/2021 | 2 Min read