mirror of
https://github.com/composer/composer
synced 2025-05-10 17:12:51 +00:00
Specialize Rule2Literal->equals(Rule2Literal) for speedup
This commit is contained in:
parent
f24fcea35b
commit
7a4937bbcc
1 changed files with 13 additions and 0 deletions
|
@ -65,6 +65,19 @@ class Rule2Literals extends Rule
|
|||
*/
|
||||
public function equals(Rule $rule)
|
||||
{
|
||||
// specialized fast-case
|
||||
if ($rule instanceof self) {
|
||||
if ($this->literal1 !== $rule->literal1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($this->literal2 !== $rule->literal2) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
$literals = $rule->getLiterals();
|
||||
if (2 != count($literals)) {
|
||||
return false;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue