This really can be a GC issue. If many objects are created and all of them cannot be "deleted", then GC in PHP starts to go crazy - it constantly tries to collect garbage, but there is nothing to remove - therefore it just spends too much CPU time / clock. This is indicated by the fact that the problem is detected only on large projects (= many objects), but not so noticeable on small ones (= GC is switched on less frequently).
In some cases, disabling GC will make execution much faster (though at the cost of consuming more memory). If no one else has tried it, then it is worth adding gc_disable () to the update / install command.
github.com/composer/composer/pull/3482#issuecomment-65131942
Before: Memory usage: 135.4MB (peak: 527.71MB), time: 119.82s After: Memory usage: 134.89MB (peak: 391.28MB), time: 11.26s Before: Memory usage: 163.66MB (peak: 403.82MB), time: 246.25s After: Memory usage: 163.34MB (peak: 350.36MB), time: 99.55s
Source: https://habr.com/ru/post/244825/
All Articles