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 2017/03/03 11:49:07 UTC
[2/4] tinkerpop git commit: Added another benchmark for adding a
whole graph with process API CTR
Added another benchmark for adding a whole graph with process API CTR
Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/07ab1209
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/07ab1209
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/07ab1209
Branch: refs/heads/TINKERPOP-1642
Commit: 07ab1209d08cc9325b3b01c9633700a80b54afec
Parents: 0934932
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Thu Mar 2 14:33:45 2017 -0500
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Thu Mar 2 14:33:45 2017 -0500
----------------------------------------------------------------------
.../gremlin/process/GraphMutateBenchmark.java | 44 ++++++++++++++++++++
1 file changed, 44 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/07ab1209/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 d446d6f..55ab14a 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
@@ -28,6 +28,8 @@ import org.apache.tinkerpop.gremlin.structure.VertexProperty;
import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.Setup;
+import java.util.Random;
+
/**
* {@code GraphMutateBenchmark} benchmarks {@link org.apache.tinkerpop.gremlin.process.traversal.Traversal} and
* {@link org.apache.tinkerpop.gremlin.structure.Graph} mutation methods.
@@ -129,6 +131,48 @@ public class GraphMutateBenchmark extends AbstractGraphMutateBenchmark {
}
@Benchmark
+ public Edge testAddVAddEWithPropsChained() {
+ // construct a traversal that adds 100 vertices with 32 properties each as well as 300 edges with 8
+ // properties each
+ final Random rand = new Random(584545454L);
+
+ GraphTraversal<Vertex, ?> t = null;
+ for (int ix = 0; ix < 10; 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));
+ }
+
+ t = t.as("person" + ix);
+
+ if (ix > 0) {
+ int edgeCount = ix == 9 ? 6 : 3;
+ for (int ie = 0; ie < edgeCount; ie++) {
+ t = t.addE("knows").from("person" + ix).to("person" + rand.nextInt(ix));
+
+ for (int iy = 0; iy < 8; iy++) {
+ if (iy % 2 == 0)
+ t = t.property("x" + String.valueOf(iy), iy * ie);
+ else
+ t = t.property("x" + String.valueOf(iy), String.valueOf(iy + ie));
+ }
+ }
+ }
+ }
+
+ final Edge e = (Edge) t.next();
+ System.out.println("****************" + graph);
+ return e;
+ }
+
+ @Benchmark
public Edge testAddE() {
return g.V(a).as("a").V(b).as("b").addE("knows").from("a").to("b").next();
}