You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@calcite.apache.org by vl...@apache.org on 2020/01/11 10:47:47 UTC
[calcite] branch master updated: Refine RuleQueue#addMatch: skip
the match if it is not required for the phase
This is an automated email from the ASF dual-hosted git repository.
vladimirsitnikov pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/calcite.git
The following commit(s) were added to refs/heads/master by this push:
new 9f67604 Refine RuleQueue#addMatch: skip the match if it is not required for the phase
9f67604 is described below
commit 9f67604c60d6ca99fc1cc8eb2182823e8f0a0c08
Author: Vladimir Sitnikov <si...@gmail.com>
AuthorDate: Sat Jan 11 13:45:48 2020 +0300
Refine RuleQueue#addMatch: skip the match if it is not required for the phase
The net result is the same, however, it avoids inflating matchList.names set,
so the change slightly reduces the memory consumption and improves performance.
---
.../main/java/org/apache/calcite/plan/volcano/RuleQueue.java | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/core/src/main/java/org/apache/calcite/plan/volcano/RuleQueue.java b/core/src/main/java/org/apache/calcite/plan/volcano/RuleQueue.java
index 655fd49..dca327e 100644
--- a/core/src/main/java/org/apache/calcite/plan/volcano/RuleQueue.java
+++ b/core/src/main/java/org/apache/calcite/plan/volcano/RuleQueue.java
@@ -327,11 +327,6 @@ class RuleQueue {
void addMatch(VolcanoRuleMatch match) {
final String matchName = match.toString();
for (PhaseMatchList matchList : matchListMap.values()) {
- if (!matchList.names.add(matchName)) {
- // Identical match has already been added.
- continue;
- }
-
Set<String> phaseRuleSet = phaseRuleMapping.get(matchList.phase);
if (phaseRuleSet != ALL_RULES) {
String ruleDescription = match.getRule().toString();
@@ -340,6 +335,11 @@ class RuleQueue {
}
}
+ if (!matchList.names.add(matchName)) {
+ // Identical match has already been added.
+ continue;
+ }
+
LOGGER.trace("{} Rule-match queued: {}", matchList.phase.toString(), matchName);
matchList.list.add(match);