tinkerpop-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ok...@apache.org
Subject tinkerpop git commit: found another minor optimziation. if the head of the path already has the extend(labels), then there is no need to split the path. This can significantly reduce object creation if label applications are repeated.
Date Wed, 02 Nov 2016 15:36:28 GMT
Repository: tinkerpop
Updated Branches:
  refs/heads/TINKERPOP-1372 deaf38a7e -> c8a689463


found another minor optimziation. if the head of the path already has the extend(labels),
then there is no need to split the path. This can significantly reduce object creation if
label applications are repeated.


Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/c8a68946
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/c8a68946
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/c8a68946

Branch: refs/heads/TINKERPOP-1372
Commit: c8a68946318cbc1ed48f1e7d1e8902d52def10bc
Parents: deaf38a
Author: Marko A. Rodriguez <okrammarko@gmail.com>
Authored: Wed Nov 2 09:36:21 2016 -0600
Committer: Marko A. Rodriguez <okrammarko@gmail.com>
Committed: Wed Nov 2 09:36:21 2016 -0600

----------------------------------------------------------------------
 .../gremlin/process/traversal/step/util/ImmutablePath.java        | 2 +-
 .../gremlin/process/traversal/step/util/MutablePath.java          | 2 +-
 .../process/traversal/traverser/B_LP_O_P_S_SE_SL_Traverser.java   | 3 +--
 3 files changed, 3 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/c8a68946/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/util/ImmutablePath.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/util/ImmutablePath.java
b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/util/ImmutablePath.java
index 6b67c45..18f0870 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/util/ImmutablePath.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/util/ImmutablePath.java
@@ -78,7 +78,7 @@ public class ImmutablePath implements Path, Serializable, Cloneable {
 
     @Override
     public Path extend(final Set<String> labels) {
-        if (labels.isEmpty())
+        if (labels.isEmpty() || this.currentLabels.containsAll(labels))
             return this;
         else {
             final Set<String> newLabels = new LinkedHashSet<>();

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/c8a68946/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/util/MutablePath.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/util/MutablePath.java
b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/util/MutablePath.java
index e9fc093..c87e627 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/util/MutablePath.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/util/MutablePath.java
@@ -80,7 +80,7 @@ public class MutablePath implements Path, Serializable {
 
     @Override
     public Path extend(final Set<String> labels) {
-        if (!labels.isEmpty())
+        if (!labels.isEmpty() && !this.labels.get(this.labels.size() - 1).containsAll(labels))
             this.labels.get(this.labels.size() - 1).addAll(labels);
         return this;
     }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/c8a68946/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/traverser/B_LP_O_P_S_SE_SL_Traverser.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/traverser/B_LP_O_P_S_SE_SL_Traverser.java
b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/traverser/B_LP_O_P_S_SE_SL_Traverser.java
index 7064cd0..49f19e4 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/traverser/B_LP_O_P_S_SE_SL_Traverser.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/traverser/B_LP_O_P_S_SE_SL_Traverser.java
@@ -75,8 +75,7 @@ public class B_LP_O_P_S_SE_SL_Traverser<T> extends B_O_S_SE_SL_Traverser<T>
{
 
     @Override
     public void addLabels(final Set<String> labels) {
-        if (!labels.isEmpty())
-            this.path = this.path.extend(labels);
+        this.path = this.path.extend(labels);
     }
 
     @Override


Mime
View raw message