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.
- PHP 7.4
- PHP 8.0
- PHP 8.0 with JIT
opcache.preload_user=www-data opcache.memory_consumption=1024 opcache.interned_strings_buffer=256 opcache.max_accelerated_files=30000 opcache.validate_timestamps=0 opcache.enable=1 opcache.enable_cli=1 opcache.file_cache="/tmp/php-file-cache" opcache.file_cache_only=1 opcache.file_cache_consistency_checks=1 # only when JIT was enabled #opcache.jit_buffer_size=512mb #opcache.jit=1225
The benchmark round included the following with an Ibexa Experience installation:
- Install without a lock file and purged caches
- Require a new package (novactive/ezseobundle)
- Install with lock file, with purged caches
- 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.
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.
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