tinkerpop-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From spmalle...@apache.org
Subject [1/2] tinkerpop git commit: TINKERPOP-1642 Added some more benchmarks around mutations
Date Thu, 02 Mar 2017 15:49:04 GMT
Repository: tinkerpop
Updated Branches:
  refs/heads/TINKERPOP-1642 [created] e79d46b85


TINKERPOP-1642 Added some more benchmarks around mutations

Needed some benchmarks that tested the addition of a Vertex with properties both for the structure
and process APIs. Also needed to benchmark long chained mutating traversals.


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

Branch: refs/heads/TINKERPOP-1642
Commit: bc6d81bd761ab749c9a15604fb9f3b944bb61dd7
Parents: 13bcdb4
Author: Stephen Mallette <spmva@genoprime.com>
Authored: Wed Mar 1 14:34:14 2017 -0500
Committer: Stephen Mallette <spmva@genoprime.com>
Committed: Wed Mar 1 16:30:18 2017 -0500

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


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/bc6d81bd/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..f005930 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
@@ -18,7 +18,9 @@
  */
 package org.apache.tinkerpop.gremlin.process;
 
+import org.apache.commons.lang.RandomStringUtils;
 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;
@@ -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.property("x" + String.valueOf(iy), iy);
+            else
+                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.property("x" + String.valueOf(iy), iy * ix);
+                else
+                    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();
     }


Mime
View raw message