1
0
Fork 0

Merge pull request #7456 from staabm/simpler-equals

Specialize Rule2Literal->equals(Rule2Literal) for speedup
pull/7432/merge
Rob 2018-07-12 10:02:36 +02:00 committed by GitHub
commit 1e9136f086
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 13 additions and 0 deletions

View File

@ -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;