1
0
Fork 0
mirror of https://github.com/composer/composer synced 2025-05-09 00:22:53 +00:00

Reduce memory footprint of rules by storing data in blob

Not declaring the job property saves significant amounts of memory as
most rules leave it as null
This commit is contained in:
Nils Adermann 2015-07-09 17:21:45 +02:00
parent b869fa9662
commit 6e81f63635
5 changed files with 37 additions and 46 deletions

View file

@ -13,6 +13,7 @@
namespace Composer\Test\DependencyResolver;
use Composer\DependencyResolver\Rule;
use Composer\DependencyResolver\RuleSet;
use Composer\DependencyResolver\Pool;
use Composer\Repository\ArrayRepository;
use Composer\TestCase;
@ -34,14 +35,6 @@ class RuleTest extends TestCase
$this->assertEquals($hash['hash'], $rule->getHash());
}
public function testSetAndGetId()
{
$rule = new Rule(array(), 'job1', null);
$rule->setId(666);
$this->assertEquals(666, $rule->getId());
}
public function testEqualsForRulesWithDifferentHashes()
{
$rule = new Rule(array(1, 2), 'job1', null);
@ -69,9 +62,9 @@ class RuleTest extends TestCase
public function testSetAndGetType()
{
$rule = new Rule(array(), 'job1', null);
$rule->setType('someType');
$rule->setType(RuleSet::TYPE_JOB);
$this->assertEquals('someType', $rule->getType());
$this->assertEquals(RuleSet::TYPE_JOB, $rule->getType());
}
public function testEnable()