Changed benchmark for addVertex() to use the object array params This is a the more likely way folks would add a vertex with the Graph API so it's a better comparison. Ultimately, the speed of the benchmark didn't change that much so that's good. CTR
Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/2138c8e1 Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/2138c8e1 Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/2138c8e1 Branch: refs/heads/TINKERPOP-1642 Commit: 2138c8e196d7b08a10510e7dffe744087e2c8e05 Parents: 3821792 Author: Stephen Mallette <sp...@genoprime.com> Authored: Mon Mar 20 13:55:08 2017 -0400 Committer: Stephen Mallette <sp...@genoprime.com> Committed: Mon Mar 20 13:55:08 2017 -0400 ---------------------------------------------------------------------- .../gremlin/process/GraphMutateBenchmark.java | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/2138c8e1/gremlin-benchmark/src/main/java/org/apache/tinkerpop/gremlin/process/GraphMutateBenchmark.java ---------------------------------------------------------------------- diff --git a/gremlin-benchmark/src/main/java/org/apache/tinkerpop/gremlin/process/GraphMutateBenchmark.java b/gremlin-benchmark/src/main/java/org/apache/tinkerpop/gremlin/process/GraphMutateBenchmark.java index 3963c49..733e32b 100644 --- a/gremlin-benchmark/src/main/java/org/apache/tinkerpop/gremlin/process/GraphMutateBenchmark.java +++ b/gremlin-benchmark/src/main/java/org/apache/tinkerpop/gremlin/process/GraphMutateBenchmark.java @@ -22,12 +22,15 @@ import org.apache.tinkerpop.benchmark.util.AbstractGraphMutateBenchmark; import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal; import org.apache.tinkerpop.gremlin.structure.Edge; import org.apache.tinkerpop.gremlin.structure.Property; +import org.apache.tinkerpop.gremlin.structure.T; import org.apache.tinkerpop.gremlin.structure.Vertex; import org.apache.tinkerpop.gremlin.structure.VertexProperty; import org.openjdk.jmh.annotations.Benchmark; import org.openjdk.jmh.annotations.Setup; +import java.util.ArrayList; +import java.util.List; import java.util.Random; /** @@ -61,15 +64,18 @@ public class GraphMutateBenchmark extends AbstractGraphMutateBenchmark { @Benchmark public Vertex testAddVertexWithProps() { - final Vertex v = graph.addVertex("test"); + final List<Object> l = new ArrayList<>(); + l.add(T.label); + l.add("test"); for (int iy = 0; iy < 32; iy++) { + l.add("x" + String.valueOf(iy)); if (iy % 2 == 0) - v.property("x" + String.valueOf(iy), iy); + l.add(iy); else - v.property("x" + String.valueOf(iy), String.valueOf(iy)); + l.add(String.valueOf(iy)); } - return v; + return graph.addVertex(l.toArray()); } @Benchmark