28 Commits (6a466a120a404d1c5d492e5ca715841c491517fc)

Author SHA1 Message Date
Jordi Boggiano 6a466a120a
Enable strict types on all files 2 years ago
Jordi Boggiano 6da38f83a0
Add parameter types to all the things 2 years ago
Alexander Schranz 1321bfca36
Add return types to closures (#9) 2 years ago
Jordi Boggiano eda9014bef
Add return types to all code which is not being extended by open source packages 2 years ago
Jordi Boggiano abdc6893a6
Add void types where no return statement is present 2 years ago
immeëmosol 50d738eeee
Reaching phpstan level 6 in Composer/DependencyResolver (refs #10159) (#10178) 3 years ago
Jordi Boggiano 4bcd860b65
Add more type annotations 3 years ago
Jordi Boggiano b7d770659b
CS fixes 4 years ago
Nils Adermann 28afc4de32 MultiConflictRules cannot be disabled, so no need to check 5 years ago
Nils Adermann ed300b9f22 New Multi Conflict Rule for transitive conflicts, to reduce memory 5 years ago
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
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
Nils Adermann ef41f136f8 Literals on rule are now public
This causes a reduction of ~500k function calls for packagist composer
update (~14 million total).
10 years ago
Jordi Boggiano ac497feaba CS fixes 10 years ago
Pavel Savinov b72c4cfe97 PHPDoc fix 11 years ago
Pascal Borreli 5eead93250 Fixed typos 12 years ago
Nils Adermann 76f8642feb Remove duplicate function from decisions 12 years ago
Nils Adermann 26e051cb76 Decisions are now encapsulated in a separate object 12 years ago
Nils Adermann 16a51daac8 Fix typo in comment 12 years ago
Jordi Boggiano 1bd4ccbd54 php-cs-fixer magic 12 years ago
Nils Adermann 76d3950992 Document the RuleWatchGraph 12 years ago
Nils Adermann 265533d390 Rename watches array to watchChains to make clearer what they are 12 years ago
Nils Adermann 025581b365 Rename walkLiteral method to more explicitly say what it does 12 years ago
Nils Adermann a395bc04d7 Get rid of continue 2; and use array_filter instead of manual looping 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 9ffe0d13f5 Remove useless if 12 years ago
Nils Adermann cdf3b4e012 Use SplDoublyLinkedList instead of custom linked list 12 years ago
Nils Adermann 731a451dfe Move handling of watch graph to separate classes 12 years ago