-
-
Notifications
You must be signed in to change notification settings - Fork 196
Speedup Composer by downloading packages in parallel #261
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
@@ -250,6 +253,21 @@ public function executeAutoScripts(Event $event) | |||
$this->io->write($this->postInstallOutput); | |||
} | |||
|
|||
public function populateCacheDir(InstallerEvent $event) | |||
{ | |||
if (extension_loaded('curl') && class_exists(Prestissimo::class, false)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you sure Prestissimo
is the right class? I can't find it on https://github.com/hirak/prestissimo
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing alias, fixed thanks
Can we include a validation for the cURL ext and if its enabled use that approach to gain the full speed? |
@bitgandtter not sure what you mean, but using cURL is far from trivial - basically, that's what https://github.com/hirak/prestissimo provides, so just use it if you have curl. |
yes my bad @nicolas-grekas i miss the above check #261 (diff) that in fact was the intent of my comment |
Thank you for your work on making symfony faster. This is a great plugin for composer totally decoupled from flex. But Flex should be installed only as dev environments and this plugin will be useful for deployments, without dev requirements. Making a separate package would be more powerful. Allowing non-flex developers to profit from this optimisation. |
Flex is part of the |
@nicolas-grekas why you doesn`t contribute this to Composer so every PHP Developer would profit from IT Not only Symfony Devs. |
@GromNaN @LKDevelopment I'm focusing on improving the Symfony + Flex based experience that's correct. That's already enough work for one (even passionate) person. |
The technical answer is that things cannot be "just" added to Composer, nor released standalone: projects have policies, stability to ensure, maintenance to accept, etc. It could happen, but that's a significant effort. Better start with some pragmatic first step. |
For the record, I think @nicolas-grekas even submitted a pull request on Composer to add such parallelization a long time ago... yep, 2.5 years ago, still open: composer/composer#3951 |
with https://github.com/amphp/artax you can get a zero dependency (php-ext wise) http parallel (non-blocking) client, maybe this is an alternative to what you have right now (and I could provide better performance). counter argument: I really like how simple this PR atm looks like. |
Thank you @nicolas-grekas. |
…colas-grekas) This PR was merged into the 1.0-dev branch. Discussion ---------- Speedup Composer by downloading packages in parallel Purpose ------- This PR is heavily inspired by the great [hirak/prestissimo](https://github.com/hirak/prestissimo) by Hiraku NAKANO. Its purpose is to provide a portable alternative to `hirak/prestissimo`, so that it can be bundled by default into Flex: unlike `hirak/prestissimo`, it doesn't require the `curl` extension and has zero extra dependencies. Instead, it reuses the existing code infrastructure in Composer to download packages. If `hirak/prestissimo` is installed, this behavior disables itself automatically. Limitations ----------- - By reusing Composer's downloader, it is not possible to create server connections concurrently. Instead, the second download is started when the first one receives its first bytes from the server, and so on. - JSON files downloaded from package repositories (e.g. from packagist.org) are still loaded sequentially (could be improved, PR welcome.) - Packages installed by cloning source code repositories are not parallelized (neither with `hirak/prestissimo`.) Commits ------- 66d9609 Speedup Composer by downloading packages in parallel
Purpose
This PR is heavily inspired by the great hirak/prestissimo by Hiraku NAKANO.
Its purpose is to provide a portable alternative to
hirak/prestissimo
, so that it can be bundled by default into Flex: unlikehirak/prestissimo
, it doesn't require thecurl
extension and has zero extra dependencies. Instead, it reuses the existing code infrastructure in Composer to download packages.Ifhirak/prestissimo
is installed, this behavior disables itself automatically.Limitations
By reusing Composer's downloader, it is not possible to create server connections concurrently.Instead, the second download is started when the first one receives its first bytes from the server, and so on.
JSON files downloaded from package repositories (e.g. from packagist.org) are still loaded sequentially (could be improved, PR welcome.)hirak/prestissimo
.)(striked limitations removed by #286)