1
0
Fork 0

Specialize Rule2Literal->equals(Rule2Literal) for speedup

pull/7456/head
Markus Staab 2018-07-10 18:24:06 +02:00
parent f24fcea35b
commit 7a4937bbcc
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;