Moved performance test from `TinkerGraphPerformanceTest` to `SackStrategyTest`.


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

Branch: refs/heads/tp32
Commit: 469f9cf64768ec50bbcbe3d1c0ea9e8bd90f9713
Parents: ea4fcdf
Author: Daniel Kuppitz <daniel_kupp...@hotmail.com>
Authored: Mon Aug 28 11:18:36 2017 -0700
Committer: Daniel Kuppitz <daniel_kupp...@hotmail.com>
Committed: Mon Aug 28 11:18:36 2017 -0700

----------------------------------------------------------------------
 .../strategy/decoration/SackStrategyTest.java   | 66 ++++++++++++++++++++
 .../traversal/TinkerGraphPerformanceTest.java   | 53 ----------------
 2 files changed, 66 insertions(+), 53 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/469f9cf6/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/SackStrategyTest.java
----------------------------------------------------------------------
diff --git 
a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/SackStrategyTest.java
 
b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/SackStrategyTest.java
new file mode 100644
index 0000000..92f25e8
--- /dev/null
+++ 
b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/SackStrategyTest.java
@@ -0,0 +1,66 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration;
+
+import org.apache.tinkerpop.gremlin.process.traversal.Operator;
+import org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategies;
+import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal;
+import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__;
+import 
org.apache.tinkerpop.gremlin.process.traversal.util.DefaultTraversalStrategies;
+import org.apache.tinkerpop.gremlin.util.TimeUtil;
+import org.junit.Test;
+import org.junit.experimental.runners.Enclosed;
+import org.junit.runner.RunWith;
+
+import java.util.stream.IntStream;
+
+import static org.hamcrest.Matchers.is;
+import static org.hamcrest.Matchers.lessThan;
+import static org.junit.Assert.assertThat;
+
+/**
+ * @author Daniel Kuppitz (http://gremlin.guru)
+ */
+@RunWith(Enclosed.class)
+public class SackStrategyTest {
+
+    public static class PerformanceTest {
+
+        /**
+         * Check the traverser's hashcode() implementation if this test fails. 
hashcode() should
+         * not generate too many hash collisions.
+         */
+        @Test
+        public void sacksWithoutMergerShouldBeFast() {
+
+            final TraversalStrategies strategies = new 
DefaultTraversalStrategies();
+            strategies.addStrategies(SackStrategy.build().initialValue(() -> 
0).create());
+
+            final Integer[] starts = IntStream.range(0, 
8192).boxed().toArray(Integer[]::new);
+            final GraphTraversal traversal = 
__.inject(starts).sack(Operator.mult).sack().barrier();
+            traversal.asAdmin().setStrategies(strategies);
+            traversal.asAdmin().applyStrategies();
+
+            final double runtime = TimeUtil.clock(10,
+                    () -> traversal.asAdmin().clone().iterate());
+
+            assertThat(runtime, is(lessThan(50.0)));
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/469f9cf6/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/process/traversal/TinkerGraphPerformanceTest.java
----------------------------------------------------------------------
diff --git 
a/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/process/traversal/TinkerGraphPerformanceTest.java
 
b/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/process/traversal/TinkerGraphPerformanceTest.java
deleted file mode 100644
index 1e2c905..0000000
--- 
a/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/process/traversal/TinkerGraphPerformanceTest.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tinkerpop.gremlin.tinkergraph.process.traversal;
-
-import 
org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
-import org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerGraph;
-import org.apache.tinkerpop.gremlin.util.TimeUtil;
-import org.junit.Test;
-
-import static org.hamcrest.Matchers.is;
-import static org.hamcrest.Matchers.lessThan;
-import static org.junit.Assert.assertThat;
-
-/**
- * @author Daniel Kuppitz (http://gremlin.guru)
- */
-public class TinkerGraphPerformanceTest {
-
-    /**
-     * Check the traverser's hashcode() implementation if this test fails. 
hashcode() should
-     * not generate too many hash collisions.
-     */
-    @Test
-    public void sacksWithoutMergerShouldBeFast() {
-
-        final TinkerGraph graph = TinkerGraph.open();
-        for (int i = 0; i < 8192; i++) {
-            graph.addVertex().property("x", 0);
-        }
-
-        final GraphTraversalSource g = graph.traversal();
-        final double runtime = TimeUtil.clock(10,
-                () -> g.withSack(0).V().values("x").barrier().iterate());
-
-        assertThat(runtime, is(lessThan(50.0)));
-    }
-}

Reply via email to