You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by sp...@apache.org on 2015/04/15 19:47:33 UTC
[11/50] incubator-tinkerpop git commit: added string interning to
StarGraph.
added string interning to StarGraph.
Project: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/commit/6a2a350c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/tree/6a2a350c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/diff/6a2a350c
Branch: refs/heads/variables
Commit: 6a2a350c570094185912d2bc74c11baa2fbeed37
Parents: 36ce514
Author: Marko A. Rodriguez <ok...@gmail.com>
Authored: Mon Apr 13 14:41:16 2015 -0600
Committer: Marko A. Rodriguez <ok...@gmail.com>
Committed: Mon Apr 13 14:48:55 2015 -0600
----------------------------------------------------------------------
.../gremlin/structure/util/star/StarGraph.java | 14 ++------------
1 file changed, 2 insertions(+), 12 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/6a2a350c/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/star/StarGraph.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/star/StarGraph.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/star/StarGraph.java
index e3971a3..db7251b 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/star/StarGraph.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/star/StarGraph.java
@@ -65,21 +65,11 @@ public final class StarGraph implements Graph {
private final Map<Object, Map<String, Object>> edgeProperties = new HashMap<>();
private final Map<Object, Map<String, Object>> metaProperties = new HashMap<>();
- private final Map<String, String> keysAndLabels = new HashMap<>();
public StarVertex getStarVertex() {
return this.starVertex;
}
- private String getKeyOrLabel(final String keyOrLabel) {
- String intern = this.keysAndLabels.get(keyOrLabel);
- if (null == intern) {
- this.keysAndLabels.put(keyOrLabel, keyOrLabel);
- intern = keyOrLabel.intern();
- }
- return intern;
- }
-
@Override
public Vertex addVertex(final Object... keyValues) {
return null == this.starVertex ?
@@ -213,7 +203,7 @@ public final class StarGraph implements Graph {
protected StarElement(final Object id, final String label) {
this.id = id;
- this.label = StarGraph.this.getKeyOrLabel(label);
+ this.label = label.intern();
}
@Override
@@ -625,7 +615,7 @@ public final class StarGraph implements Graph {
private final Element element;
public StarProperty(final String key, final V value, final Element element) {
- this.key = StarGraph.this.getKeyOrLabel(key);
+ this.key = key.intern();
this.value = value;
this.element = element;
}