How Composer accelerated 70%

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

    github.com/composer/composer/commit/ac676f47f7bbc619678a29deae097b6b0710b799

    When trying to deal with Composer's performance problem, it was suggested that the problem was caused by the garbage collector:

    This really can be a problem with the GC. If a lot of 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 clean it up - that's why it just spends extra time / processor cycles. This is also indicated by the fact that the problem is detected only on large projects (= many objects), but not so noticeable on small ones (= GC is not included so often).

    In some cases, disabling the GC will make execution much faster (though at the cost of consuming more memory). If no one else has tried, then add 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
    

    Also popular now: