Repository: tinkerpop
Updated Branches:
  refs/heads/master 81611b650 -> be2ec4995


Added some more benchmarks to cover more mutation use cases

The key addition was for chained mutation traversals which seems to be a 
pattern that is developing in the community. CTR


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

Branch: refs/heads/master
Commit: 09349322ebe75ad3b965a78f77470591ec137937
Parents: 13bcdb4
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Thu Mar 2 13:33:40 2017 -0500
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Thu Mar 2 13:33:40 2017 -0500

----------------------------------------------------------------------
 .../gremlin/process/GraphMutateBenchmark.java   | 48 ++++++++++++++++++++
 1 file changed, 48 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/09349322/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 04d7138..d446d6f 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
@@ -19,6 +19,7 @@
 package org.apache.tinkerpop.gremlin.process;
 
 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.Vertex;
@@ -32,6 +33,7 @@ import org.openjdk.jmh.annotations.Setup;
  * {@link org.apache.tinkerpop.gremlin.structure.Graph} mutation methods.
  *
  * @author Ted Wilmes (http://twilmes.org)
+ * @author Stephen Mallette (http://stephen.genoprime.com)
  */
 public class GraphMutateBenchmark extends AbstractGraphMutateBenchmark {
 
@@ -56,6 +58,19 @@ public class GraphMutateBenchmark extends 
AbstractGraphMutateBenchmark {
     }
 
     @Benchmark
+    public Vertex testAddVertexWithProps() {
+        final Vertex v = graph.addVertex("test");
+        for (int iy = 0; iy < 32; iy++) {
+            if (iy % 2 == 0)
+                v.property("x" + String.valueOf(iy), iy);
+            else
+                v.property("x" + String.valueOf(iy), String.valueOf(iy));
+        }
+
+        return v;
+    }
+
+    @Benchmark
     public VertexProperty testVertexProperty() {
         return a.property("name", "Susan");
     }
@@ -76,11 +91,44 @@ public class GraphMutateBenchmark extends 
AbstractGraphMutateBenchmark {
     }
 
     @Benchmark
+    public Vertex testAddVWithProps() {
+        GraphTraversal<Vertex, Vertex> t = g.addV("test");
+        for (int iy = 0; iy < 32; iy++) {
+            if (iy % 2 == 0)
+                t = t.property("x" + String.valueOf(iy), iy);
+            else
+                t = t.property("x" + String.valueOf(iy), String.valueOf(iy));
+        }
+        return t.next();
+    }
+
+    @Benchmark
     public Vertex testVertexPropertyStep() {
         return g.V(a).property("name", "Susan").next();
     }
 
     @Benchmark
+    public Vertex testAddVWithPropsChained() {
+        // construct a traversal that adds 100 vertices with 32 properties each
+        GraphTraversal<Vertex, Vertex> t = null;
+        for (int ix = 0; ix < 100; ix++) {
+            if (null == t)
+                t = g.addV("person");
+            else
+                t = t.addV("person");
+
+            for (int iy = 0; iy < 32; iy++) {
+                if (iy % 2 == 0)
+                    t = t.property("x" + String.valueOf(iy), iy * ix);
+                else
+                    t = t.property("x" + String.valueOf(iy), String.valueOf(iy 
+ ix));
+            }
+        }
+
+        return t.next();
+    }
+
+    @Benchmark
     public Edge testAddE() {
         return 
g.V(a).as("a").V(b).as("b").addE("knows").from("a").to("b").next();
     }

Reply via email to