-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
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
Parallel downloader #5293
Parallel downloader #5293
Conversation
porting from hirak/prestissimo
|
||
public static function generateUserAgent() | ||
{ | ||
static $ua; |
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 all this caches really required?
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.
Looks like some mirco ootimizing
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.
Because User-Agent is never-changed string in Composer process. But it was off the subject(parallel downloading).
Should I remove it for simplicity ?
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.
If it doesnt improve by a measurable amount of time I would drop it
Any numbers how much faster downloading gets with this PR? |
/** @var resource<stream<plainfile>> */ | ||
protected $fp; | ||
|
||
protected $success = 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.
I suggest using private visibility for all of them. It makes maintaining backward compatibility much easier (as anything private is outside the surface concerned with BC, while protected stuff is inside it due to inheritance)
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.
👍 OK
@staabm It is a difficult question. Because it depends geolocation, composer command, etc.. For example, I benchmarked by San Francisco
Singapore
Details below |
Test failure is not my fault. |
private static function ifOr($str, $pre = '', $post = '') | ||
{ | ||
if ($str) { | ||
return "$pre$str$post"; |
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.
return $pre . $str . $post;
I built composer.phar for trial. |
if ($this->user) { | ||
$user = $this->user; | ||
$user .= self::ifOr($this->pass, ':'); | ||
$url .= "$user@"; |
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.
$url .= $user . '@';
$this->permanent = $permanent; | ||
|
||
// for PHP<5.5 @see getFinishedResults() | ||
$this->blackhole = fopen('php://memory', 'wb'); |
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.
$this->blackhole = tmpfile();
or $this->blackhole = fopen('php://temp', 'wb');
I think 'php://temp' is better.
http://stackoverflow.com/questions/6841854/how-to-do-curl-put-requests-with-a-php-memory-file-handle
} | ||
} while ($remains > 0); | ||
|
||
return compact('successCnt', 'failureCnt', 'urls'); |
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.
compact
is not opimizable by php runtimes, better use the longer and more explicit form
|
Any news on this? |
@hirak Updates? |
@Seldaek are there any Planes to merge this? I Install this Plugin in every Environment we Develop or deploy and IT Speeds Up our deployment process 50% |
This will help a lot. |
Please merge. We're seeing major gains with parallel composer install/update. |
Any news about this issue? |
Hope you guys give a look for this pull, its been months I'm waiting this feature |
Still waiting for it :( |
please stop spamming this topic with useless comments. jordi is aware that a lot of people would love this feature, but it is not top priority. everybody can use the plugin in the meantime. |
Closed by #7904 which adds curl-multi support for the upcoming 2.0 |
Parallel Prefetcher
porting from https://github.com/hirak/prestissimo
Composer\Installer::doInstall()
Composer\Util\RemoteFilesystem
.repository.json
download in serial!extension_loaded('curl')
, then fallback to RemoteFilesystemSee also
#2696
#3930 (comment)
Question
github-token
,gitlab-token
options are still alive?composer/src/Composer/Util/RemoteFilesystem.php
Line 235 in 36665d7
composer/src/Composer/Util/RemoteFilesystem.php
Line 240 in 36665d7
I can't find any documentation about that options. In this P-R, I didn't implement it yet.