24 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
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 81bf47ffa2
Use fully qualified calls in hot classes 4 years ago
Nils Adermann ed300b9f22 New Multi Conflict Rule for transitive conflicts, to reduce memory 5 years ago
Markus Staab 50565cb0c8 Use variable to call count() less often 6 years ago
Gabriel Caruso 32a409a3ee Clean elses 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
Jordi Boggiano ce08582671 Fix CS 9 years ago
Andreas Möller e184118d76 Fix: Docblock 9 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
Thai Phan e6fdefb869 Update RuleWatchNode.php 10 years ago
Nils Adermann 8369624c49 Correctly set watch2 on rule watch nodes for learned rules fixes #2181 11 years ago
Nils Adermann 26e051cb76 Decisions are now encapsulated in a separate object 12 years ago
Jordi Boggiano 1bd4ccbd54 php-cs-fixer magic 12 years ago
Nils Adermann f193d61dfe Remove unecessary brackets 12 years ago
Nils Adermann 7f9c5ffeef Add documentation to RuleWatchChain and RuleWatchNode 12 years ago
Nils Adermann e817a2e2d7 Move public members above protected members in rule watch node 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 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