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/10 15:35:03 UTC

[7/9] incubator-tinkerpop git commit: Check for specific type in IdManagers and return without additional conversion.

Check for specific type in IdManagers and return without additional conversion.

Seems to save a tick or two on the processing as performance tests seem to run more inline as a result.


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

Branch: refs/heads/TINKERPOP3-581
Commit: fe106adcc69a708f8c99be9ce97f5617a84217fc
Parents: c3c1c01
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Fri Apr 10 08:50:47 2015 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Fri Apr 10 08:50:47 2015 -0400

----------------------------------------------------------------------
 .../tinkerpop/gremlin/tinkergraph/structure/TinkerGraph.java | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/fe106adc/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraph.java
----------------------------------------------------------------------
diff --git a/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraph.java b/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraph.java
index 1d26304..339d677 100644
--- a/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraph.java
+++ b/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraph.java
@@ -488,7 +488,9 @@ public class TinkerGraph implements Graph {
 
             @Override
             public Object convert(final Object id) {
-                if (id instanceof Number)
+                if (id instanceof Long)
+                    return id;
+                else if (id instanceof Number)
                     return ((Number) id).longValue();
                 else if (id instanceof String)
                     return Long.parseLong((String) id);
@@ -509,7 +511,9 @@ public class TinkerGraph implements Graph {
 
             @Override
             public Object convert(final Object id) {
-                if (id instanceof Number)
+                if (id instanceof Integer)
+                    return id;
+                else if (id instanceof Number)
                     return ((Number) id).intValue();
                 else if (id instanceof String)
                     return Integer.parseInt((String) id);