composer/composer — pull request #3474 by joshdifabio (2014-11-28 18:03:01+00:00)
Title: [WIP] Non-blocking SVN and Git repositories

Composer spends a lot of time blocking on I/O. For example, when reading the branches and tags from a VCS repository Composer will execute multiple slow commands for each repository and, potentially, multiple commands for every branch and tag within that repository. Composer waits idly for each command to complete before continuing to execute other commands.

In an ideal world, much of Composer would be written in a non-blocking way since the application spends so much time blocking on I/O. This pull request takes a more pragmatic approach by changing very little of the existing code base, while still achieving significant performance gains.

This pull request adds the ability to implement repository classes which can be initialized in a non-blocking manner. A new repository manager is provided which initializes all non-blocking repositories in parallel. I have implemented non-blocking SVN and Git repository classes, while all other repository classes continue to work in the traditional manner; blocking PHP while they execute commands.

So far, I have been able to reduce my company's Satis build time from over 30 minutes to under two minutes with these changes. I plan to implement non-blocking downloaders, other repositories and unit tests when time allows.