-
-
Notifications
You must be signed in to change notification settings - Fork 196
Description
Hi all,
I've noticed that using unbounded constraints like "symfony/foo": "*"
together with "extra.symfony.require" makes for a project that's easy to update. Doing so severely impacts both execution time as well as memory usage.
In my tests, I've taken a slightly modified composer.json
from symfony/demo
, locked on 4.1. File here.
In all tests, I've cleared the setup as well as composer's cache:
rm -rf composer.lock vendor
composer clearcache
First, I tested it with all symfony/foo
constraints set to ^4.1
, and ran:
time COMPOSER_MEMORY_LIMIT=-1 memusg composer install
time
is a utility to measure execution time, memusg
is a small script that polls for memory usage, from here.
The results are:
- composer install 16,59s user 6,89s system 42% cpu 54,963 total
- memusg: peak= 1209472
Next, I've set all the constraints to an 'unbounded' *
, and ran the same commands as above. Results:
- composer install 36,76s user 7,93s system 61% cpu 1:12,52 total
- memusg: peak= 2302040
Finally, I've reverted the constraints back to ^4.1
, but I removed the extra.symfony.require
and ran the same commands. Results:
- composer install 16,84s user 6,73s system 42% cpu 55,991 total
- memusg: peak= 1208248
So, comparable to the first case.
You'll see that using unbound constraints took twice as long (37 vs 17 seconds), and uses almost twice as much memory(2.3 GB vs 1.2 GB). I have no idea if this is something that we can fix, because dependency resolution is hard and complex, but I just wanted to point it out. In the current situation I'd advise people to keep their constraints locked down as much as possible, because of the above.
Pinging @weaverryan :-)