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 2018/04/20 23:38:59 UTC
[1/3] tinkerpop git commit: Make ResponseExceptions constructor
public CTR [Forced Update!]
Repository: tinkerpop
Updated Branches:
refs/heads/TINKERPOP-1950 b8c44bf12 -> d7d0aafc0 (forced update)
Make ResponseExceptions constructor public CTR
This makes the ResponseException easier to use in tests for users of
Gremlin.Net.
Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/25913023
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/25913023
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/25913023
Branch: refs/heads/TINKERPOP-1950
Commit: 25913023561f76043e11ff0813b2c8ece57274b5
Parents: b99c56a
Author: Florian Hockmann <fh...@florian-hockmann.de>
Authored: Thu Apr 19 16:08:03 2018 +0200
Committer: Florian Hockmann <fh...@florian-hockmann.de>
Committed: Thu Apr 19 16:08:03 2018 +0200
----------------------------------------------------------------------
.../src/Gremlin.Net/Driver/Exceptions/ResponseException.cs | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/25913023/gremlin-dotnet/src/Gremlin.Net/Driver/Exceptions/ResponseException.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/src/Gremlin.Net/Driver/Exceptions/ResponseException.cs b/gremlin-dotnet/src/Gremlin.Net/Driver/Exceptions/ResponseException.cs
index 4706723..8d26106 100644
--- a/gremlin-dotnet/src/Gremlin.Net/Driver/Exceptions/ResponseException.cs
+++ b/gremlin-dotnet/src/Gremlin.Net/Driver/Exceptions/ResponseException.cs
@@ -30,7 +30,11 @@ namespace Gremlin.Net.Driver.Exceptions
/// </summary>
public class ResponseException : Exception
{
- internal ResponseException(string message) : base(message)
+ /// <summary>
+ /// Initializes a new instance of the <see cref="ResponseException" /> class.
+ /// </summary>
+ /// <param name="message">The error message string.</param>
+ public ResponseException(string message) : base(message)
{
}
}
[2/3] tinkerpop git commit: TINKERPOP-1936 Improved performance of
Bytecode deserialization.
Posted by sp...@apache.org.
TINKERPOP-1936 Improved performance of Bytecode deserialization.
GraphSON deserialization of Bytecode was using generic List deserialization which became especially costly for Jackson in 2.5.x because of changes that synchronized access to the deserialization cache and because the collection deserialization were no longer cacheable when type deserialization was in play. This change removed the use of generic type lists in deserialization and more directly handled the parsing of the lists thus bypassing the collection deserializer for this specific case.
Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/682f298c
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/682f298c
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/682f298c
Branch: refs/heads/TINKERPOP-1950
Commit: 682f298cc82d66fd7040cb29a7d3b769be5e2794
Parents: 2591302
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Thu Apr 12 10:25:20 2018 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Fri Apr 20 19:29:02 2018 -0400
----------------------------------------------------------------------
CHANGELOG.asciidoc | 1 +
.../io/graphson/TraversalSerializersV2d0.java | 35 +++++++++++++-------
2 files changed, 24 insertions(+), 12 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/682f298c/CHANGELOG.asciidoc
----------------------------------------------------------------------
diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc
index 0f3a71a..51c9f68 100644
--- a/CHANGELOG.asciidoc
+++ b/CHANGELOG.asciidoc
@@ -24,6 +24,7 @@ image::https://raw.githubusercontent.com/apache/tinkerpop/master/docs/static/ima
=== TinkerPop 3.2.9 (Release Date: NOT OFFICIALLY RELEASED YET)
* Bumped to httpclient 4.5.5.
+* Improved performance of GraphSON deserialization of `Bytecode`.
[[release-3-2-8]]
=== TinkerPop 3.2.8 (Release Date: April 2, 2018)
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/682f298c/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/TraversalSerializersV2d0.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/TraversalSerializersV2d0.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/TraversalSerializersV2d0.java
index a696280..040fd1d 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/TraversalSerializersV2d0.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/TraversalSerializersV2d0.java
@@ -248,8 +248,6 @@ final class TraversalSerializersV2d0 {
//////////////////
final static class BytecodeJacksonDeserializer extends StdDeserializer<Bytecode> {
- private static final JavaType listJavaType = TypeFactory.defaultInstance().constructCollectionType(ArrayList.class, Object.class);
- private static final JavaType listListJavaType = TypeFactory.defaultInstance().constructCollectionType(ArrayList.class, listJavaType);
public BytecodeJacksonDeserializer() {
super(Bytecode.class);
@@ -260,17 +258,30 @@ final class TraversalSerializersV2d0 {
final Bytecode bytecode = new Bytecode();
while (jsonParser.nextToken() != JsonToken.END_OBJECT) {
- if (jsonParser.getCurrentName().equals(GraphSONTokens.SOURCE)) {
+ final String current = jsonParser.getCurrentName();
+ if (current.equals(GraphSONTokens.SOURCE) || current.equals(GraphSONTokens.STEP)) {
jsonParser.nextToken();
- final List<List<Object>> instructions = deserializationContext.readValue(jsonParser, listListJavaType);
- for (final List<Object> instruction : instructions) {
- bytecode.addSource((String) instruction.get(0), Arrays.copyOfRange(instruction.toArray(), 1, instruction.size()));
- }
- } else if (jsonParser.getCurrentName().equals(GraphSONTokens.STEP)) {
- jsonParser.nextToken();
- final List<List<Object>> instructions = deserializationContext.readValue(jsonParser, listListJavaType);
- for (final List<Object> instruction : instructions) {
- bytecode.addStep((String) instruction.get(0), Arrays.copyOfRange(instruction.toArray(), 1, instruction.size()));
+
+ while (jsonParser.nextToken() != JsonToken.END_ARRAY) {
+
+ // there should be a list now and the first item in the list is always string and is the step name
+ // skip the start array
+ jsonParser.nextToken();
+
+ final String stepName = jsonParser.getText();
+
+ // iterate through the rest of the list for arguments until it gets to the end
+ final List<Object> arguments = new ArrayList<>();
+ while (jsonParser.nextToken() != JsonToken.END_ARRAY) {
+ // we don't know the types here, so let the deserializer figure that business out
+ arguments.add(deserializationContext.readValue(jsonParser, Object.class));
+ }
+
+ // if it's not a "source" then it must be a "step"
+ if (current.equals(GraphSONTokens.SOURCE))
+ bytecode.addSource(stepName, arguments.toArray());
+ else
+ bytecode.addStep(stepName, arguments.toArray());
}
}
}
[3/3] tinkerpop git commit: TINKERPOP-1950 Cached global strategy
lookups during traversal construction
Posted by sp...@apache.org.
TINKERPOP-1950 Cached global strategy lookups during traversal construction
This change leads to a 1.5x to 2x speed improvement in traversal construction. It is especially effective when processing traversals that have many child traversals within them as this method is called for not only the parent traversal but all the children as well.
Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/d7d0aafc
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/d7d0aafc
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/d7d0aafc
Branch: refs/heads/TINKERPOP-1950
Commit: d7d0aafc08cf8600b03d4d9d79ce52056d694a4f
Parents: 682f298
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Fri Apr 20 16:18:13 2018 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Fri Apr 20 19:38:37 2018 -0400
----------------------------------------------------------------------
.../process/traversal/TraversalStrategies.java | 29 ++++++++++++++------
1 file changed, 21 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/d7d0aafc/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/TraversalStrategies.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/TraversalStrategies.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/TraversalStrategies.java
index c7ee5bf..7ca5b61 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/TraversalStrategies.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/TraversalStrategies.java
@@ -63,6 +63,8 @@ import java.util.stream.Collectors;
*/
public interface TraversalStrategies extends Serializable, Cloneable {
+ static Set<Class> LOADED = new HashSet<>();
+
static List<Class<? extends TraversalStrategy>> STRATEGY_CATEGORIES = Collections.unmodifiableList(Arrays.asList(TraversalStrategy.DecorationStrategy.class, TraversalStrategy.OptimizationStrategy.class, TraversalStrategy.ProviderOptimizationStrategy.class, TraversalStrategy.FinalizationStrategy.class, TraversalStrategy.VerificationStrategy.class));
/**
@@ -244,20 +246,31 @@ public interface TraversalStrategies extends Serializable, Cloneable {
public static TraversalStrategies getStrategies(final Class graphOrGraphComputerClass) {
try {
// be sure to load the class so that its static{} traversal strategy registration component is loaded.
- // this is more important for GraphComputer classes as they are typically not instantiated prior to strategy usage like Graph classes.
- final String graphComputerClassName = null != graphOrGraphComputerClass.getDeclaringClass() ?
+ // this is more important for GraphComputer classes as they are typically not instantiated prior to
+ // strategy usage like Graph classes.
+ if (!LOADED.contains(graphOrGraphComputerClass)) {
+ final String graphComputerClassName = null != graphOrGraphComputerClass.getDeclaringClass() ?
graphOrGraphComputerClass.getCanonicalName().replace("." + graphOrGraphComputerClass.getSimpleName(), "$" + graphOrGraphComputerClass.getSimpleName()) :
graphOrGraphComputerClass.getCanonicalName();
- Class.forName(graphComputerClassName);
+ Class.forName(graphComputerClassName);
+
+ // keep track of stuff we already loaded once - stuff in this if/statement isn't cheap and this
+ // method gets called a lot, basically every time a new traversal gets spun up (that includes
+ // child traversals.
+ LOADED.add(graphOrGraphComputerClass);
+ }
} catch (final ClassNotFoundException e) {
throw new IllegalStateException(e.getMessage(), e);
}
- if (Graph.class.isAssignableFrom(graphOrGraphComputerClass)) {
- final TraversalStrategies traversalStrategies = GRAPH_CACHE.get(graphOrGraphComputerClass);
- return null == traversalStrategies ? GRAPH_CACHE.get(Graph.class) : traversalStrategies;
+
+ if (GRAPH_CACHE.containsKey(graphOrGraphComputerClass)) {
+ return GRAPH_CACHE.get(graphOrGraphComputerClass);
+ } else if (Graph.class.isAssignableFrom(graphOrGraphComputerClass)) {
+ return GRAPH_CACHE.get(Graph.class);
+ } else if (GRAPH_COMPUTER_CACHE.containsKey(graphOrGraphComputerClass)) {
+ return GRAPH_COMPUTER_CACHE.get(graphOrGraphComputerClass);
} else if (GraphComputer.class.isAssignableFrom(graphOrGraphComputerClass)) {
- final TraversalStrategies traversalStrategies = GRAPH_COMPUTER_CACHE.get(graphOrGraphComputerClass);
- return null == traversalStrategies ? GRAPH_COMPUTER_CACHE.get(GraphComputer.class) : traversalStrategies;
+ return GRAPH_COMPUTER_CACHE.get(GraphComputer.class);
} else {
throw new IllegalArgumentException("The TraversalStrategies.GlobalCache only supports Graph and GraphComputer strategy caching: " + graphOrGraphComputerClass.getCanonicalName());
}