28 Commits (e022c073706769d0486de96de0f98719cd9950b5)

Author SHA1 Message Date
Gabriel Caruso 2a13bb2649 Fixes from PHPStan (#7687)
* fix docblocks

* remove redundant conditional

* fix wrong variable name

* fix wrong namespaces

* add missing private members

* remove unused/redundant arguments

* move testcase class

* exclude TestCase.php

* Tweak RuleWatchGraph type hints

* Tweak doc comment
6 years ago
Christophe Coevoet e5b948c683 Refactor the handling of conflict rules in the solver
Conflict rules are not added in the solver based on the packages loaded in the
solver by require rules, instead of loading remote metadata for them. This has
2 benefits:

- it reduces the number of conflict rules in the solver in case of conflict
  rules targetting packages which are not required
- it fixes the behavior of replaces, which is meant to conflict with all
  versions of the replaced package, without introducing a performance
  regression (this behavior was changed when optimizing composer in the past).
6 years ago
Markus Staab f7a1c34c92
Removed unused variables 6 years ago
Markus Staab 07383552b3
Temporary save the package-name into a variable
this reduces number of unnecessary function calls in the hot path of "composer update"
6 years ago
Gabriel Caruso 7d9f8e2247
Improvements
Small improvements, such as remove unused imports, unecessaries casts, parentheses, etc.
6 years ago
Jordi Boggiano c0eb32669a Remove comment 7 years ago
Vladimir Reznichenko c8615358cb SCA with PHP Inspections (EA Extended) 7 years ago
rubenrua 4e1887a721 Improve memory usage resolving dependencies
It is known that composer update takes a lot of memory: #5915, #5902,

I am playing with a profiler (@blackfireio) to make a demo in my local
PHP meetup (@phpvigo) and I found out a way to use less memory. These
are my first tests:

* Private project using PHP 5.6:
  * Memory: from 1.31GB to 1.07GB
  * Wall Time: from 2min 8s to 1min 33s

* symfony-demo using PHP 7.1 in my old mac book:
  * Memory: from 667MB to 523MB
  * Wall Time: from  5min 29s to 5min 28s

Not use an array inside conflict rules is this improvement main idea:

```php
<?php
//Memory 38MB
gc_collect_cycles();
gc_disable();

class Rule
{
    public $literals;

    public function __construct(array $literals)
    {
        $this->literals = $literals;
    }
}

$rules = array();

$i = 0;
while ($i<80000){ //
    $i++;

    $array = array(-$i, $i);
    $rule = new Rule($array);
    $rules[] = $rule;
}
```

```php
<?php
//Memory 11.1MB
gc_collect_cycles();
gc_disable();

class Rule2Literals
{
    public $literal1;
    public $literal2;

    public function __construct($literal1, $literal2)
    {
        $this->literal1 = $literal1;
        $this->literal2 = $literal2;
    }
}

$rules = array();

$i = 0;
while ($i<80000){ //
    $i++;

    $rule = new ConflictRule(-$i, $i);
    $rules[] = $rule;
}
```

More info https://github.com/composer/composer/pull/6168
7 years ago
Yanick Witschi 4a769a785c Reduce calls on Rule::getHash() 8 years ago
Steve Preston dfe18d2e7f Fixed dependency problem caused by pull request #3482 10 years ago
Nils Adermann 4a945da55b Avoid generating duplicate conflict rules
For each version of each package we create a conflict rule with each
other version. These are then added to the rule set and skipped if
duplicate so instead we can just generate them only once to begin with
and avoid unnecessary memory allocation and duplication lookups.
10 years ago
Nils Adermann 26598c4a9a Remove unnecessary pool reference from rules 10 years ago
Nils Adermann c6af09b1da Make project id public
Reduction of rougly 1.3 million function calls on packagist update
10 years ago
Nils Adermann ee56db8767 Remove the handling of updates in the generator
Updates are implicitly handled by whatProvides for install requests
10 years ago
Jordi Boggiano ec0463a400 Add tests for platform packages required by root and avoid creating rules altogether instead of disabling them, refs #3320 10 years ago
Jordi Boggiano ac497feaba CS fixes 10 years ago
Jordi Boggiano e23665be59 Fix replacers being picked if whatProvide was called before building the package whitelist, fixes #2991, fixes #2962 10 years ago
Nils Adermann 5b80144ad0 Resolve job packages after whitelist generation 11 years ago
Nils Adermann 3148ffd355 Whitelist packages with names matching those specified before generating rules
Addresses #2690 doesn't do any performance optimisations yet which we
could do now
11 years ago
Pascal Borreli 83fd3967f0 Fixed PHPDoc 12 years ago
Nils Adermann cc7632489d Make problem report messages more readable
Added pretty strings to constraints
12 years ago
Nils Adermann dc2a9bfe62 Ignore null rules in rule generator
Fixes #806
12 years ago
Nils Adermann 1211d8f7d4 Correctly generate conflict and alias rules for installed packages 12 years ago
Jordi Boggiano 1bd4ccbd54 php-cs-fixer magic 12 years ago
Nils Adermann 21c7e219e2 Change "else if" to "elseif" 12 years ago
Nils Adermann 99200af51b Correctly indent break statements 12 years ago
Nils Adermann 451bab1c2c Get rid of Literal object / literal id mix, use literals only to save memory 12 years ago
Nils Adermann 46e4ae0e6a Move rule generation from solver into separate rule set generator 12 years ago