1
0
Fork 0
Go to file
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
2017-02-20 18:52:17 +00:00
.github Add security email for sensitive reports 2016-11-17 14:40:36 +01:00
bin Add a COMPOSER_BINARY env var so that chdir does not affect @composer script resolvability, fixes #6080 2017-01-22 18:26:49 +01:00
doc Replace toran 2017-02-10 13:32:08 +01:00
res Fix typo 2017-01-03 11:34:29 +01:00
src Improve memory usage resolving dependencies 2017-02-20 18:52:17 +00:00
tests Improve memory usage resolving dependencies 2017-02-20 18:52:17 +00:00
.gitattributes Add gitattributes for yml files 2016-09-04 14:24:55 +02:00
.gitignore Add PHPCSFixer config 2015-04-15 01:22:20 +01:00
.php_cs Run cs fixer and update config to latest master 2016-04-11 15:06:57 +01:00
.travis.yml Add php7.1 to the build 2016-09-14 11:33:43 +02:00
CHANGELOG.md Prep 1.3.2 2017-01-27 18:22:22 +01:00
LICENSE lets avoid silly commits in the future 2017-01-19 12:10:26 +01:00
PORTING_INFO Import initial partial port of the libzypp satsolver. 2011-04-05 17:37:19 +02:00
README.md Add security email for sensitive reports 2016-11-17 14:40:36 +01:00
appveyor.yml appveyor.yml: use one type of indentation 2016-08-29 15:15:58 +02:00
composer.json Update the branch alias for master 2017-01-03 09:50:47 +01:00
composer.lock Merge pull request #6013 from stof/repository_schema 2016-12-31 16:42:14 +01:00
phpunit.xml.dist Stop running PEAR Repo test suite as it fails and is kinda irrelevant at this point 2016-02-25 13:10:46 +00:00

README.md

Composer - Dependency Management for PHP

Composer helps you declare, manage and install dependencies of PHP projects.

See https://getcomposer.org/ for more information and documentation.

Build Status Dependency Status Reference Status

Installation / Usage

Download and install Composer by following the official instructions.

For usage, see the documentation.

Packages

Find packages on Packagist.

Community

IRC channels are on irc.freenode.org: #composer for users and #composer-dev for development.

For support, Stack Overflow also offers a good collection of Composer related questions.

Please note that this project is released with a Contributor Code of Conduct. By participating in this project and its community you agree to abide by those terms.

Requirements

PHP 5.3.2 or above (at least 5.3.4 recommended to avoid potential bugs)

Authors

See also the list of contributors who participated in this project.

Security Reports

Please send any sensitive issue to security@packagist.org. Thanks!

License

Composer is licensed under the MIT License - see the LICENSE file for details

Acknowledgments

  • This project's Solver started out as a PHP port of openSUSE's Libzypp satsolver.
  • This project uses hiddeninput.exe to prompt for passwords on windows, sources and details can be found on the github page of the project.