In the hunt for the cause of #1322682: Many conditions may result in memory crashes? I noticed that RulesState::defaultVariables looks like is being called multiple times needlessly in includes/rules.core.inc.
Was:
public function availableVariables() {
$vars = RulesState::defaultVariables();
return !$this->isRoot() ? $this->parent->stateVariables($this) : $vars;
}
Changed to:
public function availableVariables() {
return !$this->isRoot() ? $this->parent->stateVariables($this) : RulesState::defaultVariables();
}
Which should mean that RulesState::defaultVariables() is only ever called when $this->isRoot is TRUE, and not every single time availableVariables() is called.
| Comment | File | Size | Author |
|---|---|---|---|
| #1 | 1383750.1-rules-availableVariables-performance.patch | 528 bytes | mrfelton |
Comments
Comment #1
mrfelton commentedComment #2
acrazyanimal commented@mrfelton: Did you notice if this had an improving impact on the performance issue you noted in #1383522: Huge performance impact when using lots of 'entity has field' checks. ??
Comment #3
mrfelton commentedNo (or little) impact on that other issue.
Comment #4
fagoThanks for catching this, committed.