Skip to content
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

Load only explicitly named package data #3994

Merged
merged 15 commits into from Jun 18, 2015

Conversation

naderman
Copy link
Member

@naderman naderman commented May 4, 2015

This will significantly reduce the amount of loaded metadata for the solver. This should improve network time as well as solver complexity.

@@ -96,6 +96,151 @@ public function setRootAliases(array $rootAliases)
$this->rootAliases = $rootAliases;
}

public function ensureLoaded($pool, array $constrainedNames)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$pool should be typehinted

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't mean to leave any of this code as-is, this was a POC to see if this is doable, I'll rewrite all of this anyway.

@naderman naderman changed the title Load only explicitly named package data [WIP] Load only explicitly named package data May 4, 2015
$packages = $this->loadName($pool, $packageSpec['name']);

foreach ($packages as $package) {
foreach ($package->getRequires() as $link) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't this be handled in the Pool to ensure that dependencies can be provided by other repositories ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please read my reply :(

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and what about dev requirements for the root package ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@naderman your replies don't appear in the diff of the PR until I reload the diff 😄

@stof
Copy link
Contributor

stof commented May 4, 2015

Something looks broken. Tests are not passing

@naderman
Copy link
Member Author

naderman commented May 4, 2015

Yes because the current list of loaded packages doesn't actually contain everything that is needed.

@naderman
Copy link
Member Author

naderman commented May 4, 2015

Again this is really just a FYI PR that I was discussing with jordi which I didn't want to just live on my disk, no need to discuss this yet.

@naderman
Copy link
Member Author

naderman commented May 4, 2015

current composer:

naderman@Montsoreau:~/projects/composer/test/ezpublish-community (master) $ ./composer.phar update -v --profile --dry-run --ignore-platform-reqs --no-dev                                                                                                                      
[8.6MB/0.11s] Loading composer repositories with package information
[8.9MB/0.37s] Updating dependencies
[312.7MB/29.30s] Memory usage: 312.66MB (peak: 899.13MB), time: 29.3s

with this patch which still loads full provider files, and only reduces the data after it is downloaded:

naderman@Montsoreau:~/projects/composer/test/ezpublish-community (master) $ ../../composer/bin/composer update -v --profile --dry-run --ignore-platform-reqs --no-dev
[8.9MB/0.11s] Loading composer repositories with package information
[9.2MB/0.35s] Updating dependencies
[259.6MB/22.85s] Memory usage: 259.6MB (peak: 759.64MB), time: 22.85s

So pretty confident this can make a significant performance impact if implemented properly.

@naderman naderman changed the title [WIP] Load only explicitly named package data Load only explicitly named package data May 5, 2015
@naderman
Copy link
Member Author

naderman commented May 5, 2015

Alright I think this is ready to be reviewed as-is @Seldaek @stof - as a next step we could look into changing the json data that is downloaded off of packagist, this is unchanged in the PR for now.

return $this->rootAliases;
}

public function loadRecursively(array $packageNames, $acceptableCallback)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please add some phpdoc to document that the second argument is a callable, as we cannot typehint it

@naderman
Copy link
Member Author

naderman commented Jun 8, 2015

Fixed everything @stof brought up - want to merge this then @Seldaek ?

@Seldaek
Copy link
Member

Seldaek commented Jun 18, 2015

Alright looking good, it reduces memory footprint a little and runtime as well since we process less files so that means less network time too which is nice.

A good side effect though is that it moves all the loading ahead of the solver, so there won't be confusion anymore as to what it's doing between downloading two files, now they should download quick and then solving starts.

@Seldaek Seldaek merged commit e25b86c into composer:master Jun 18, 2015
@ghost
Copy link

ghost commented Jun 18, 2015

@Seldaek @naderman After this was merged I've started to get errors when using private (Satis) and public packages together.
Here's a slightly obfuscated error message:

Problem 1
  - Installation request for private/package1 dev-master -> satisfiable by private/package1[dev-master].
  - private/package1 dev-master requires anchu/ftp 0.0.1 -> no matching package found.
Problem 2
   - Installation request for private/package2 dev-master -> satisfiable by private/package2[dev-master].
   - private/package2 dev-master requires squizlabs/php_codesniffer 1.* -> no matching package found.
 Problem 3
   - Installation request for private/package3 1.*@dev -> satisfiable by private/package3[1.0.x-dev].
   - private/package3 1.0.x-dev requires aws/aws-sdk-php 2.6.* -> no matching package found.

Reverting composer to a version right before this change (b025d09) fixes this.

@stof
Copy link
Contributor

stof commented Jun 18, 2015

Do you have capital letters in the name of packages in your Satis repo ?

@ghost
Copy link

ghost commented Jun 18, 2015

Nope, no capital letters in package names. There are capital letters in some version names though (branch names) - not sure if that matters.

@stof
Copy link
Contributor

stof commented Jun 18, 2015

nope, it should not

@naderman
Copy link
Member Author

Well the issue seems to be that for some reason some packages are not being loaded. Since this is multiple repositories I figure there is some issue in that section of the code, that tries to load names it found as deps in one repo in another.

@naderman
Copy link
Member Author

Would be great if we had a test for this ^_^ Locally just using a satis repo works fine.

@naderman
Copy link
Member Author

Going to revert this, while I debug, as this may take a while.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants