📜 ⬆️ ⬇️

How Composer is 70% sped up

image
Apparently, before our eyes, another legendary commit was born (carefully, in the comments, solid gifs):

github.com/composer/composer/commit/ac676f47f7bbc619678a29deae097b6b0710b799

When trying to deal with the Composer performance problem, it was suggested that the cause of the problem lies in the garbage collector:
')
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

The results, by the way, were more than encouraging:

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