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 2016/10/19 20:54:30 UTC
[8/8] tinkerpop git commit: TINKERPOP-1514 Added gremlin-tools module.
TINKERPOP-1514 Added gremlin-tools module.
Moved gremlin-benchmark to gremlin-tools and added gremlin-coverage. CTR
Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/288351cc
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/288351cc
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/288351cc
Branch: refs/heads/master
Commit: 288351cc491510eb96a3d39d05bf2e65b9f82c3f
Parents: 8666ea6
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Tue Oct 18 15:35:04 2016 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Wed Oct 19 14:02:40 2016 -0400
----------------------------------------------------------------------
CHANGELOG.asciidoc | 5 +-
.../developer/development-environment.asciidoc | 2 +
gremlin-benchmark/pom.xml | 211 -------------------
.../benchmark/util/AbstractBenchmarkBase.java | 117 ----------
.../benchmark/util/AbstractGraphBenchmark.java | 85 --------
.../util/AbstractGraphMutateBenchmark.java | 48 -----
.../gremlin/process/GraphMutateBenchmark.java | 92 --------
.../process/GraphTraversalBenchmark.java | 101 ---------
gremlin-test/pom.xml | 1 +
gremlin-tools/gremlin-benchmark/pom.xml | 134 ++++++++++++
.../benchmark/util/AbstractBenchmarkBase.java | 117 ++++++++++
.../benchmark/util/AbstractGraphBenchmark.java | 85 ++++++++
.../util/AbstractGraphMutateBenchmark.java | 48 +++++
.../gremlin/process/GraphMutateBenchmark.java | 92 ++++++++
.../process/GraphTraversalBenchmark.java | 101 +++++++++
gremlin-tools/gremlin-coverage/pom.xml | 118 +++++++++++
gremlin-tools/pom.xml | 31 +++
pom.xml | 4 +-
18 files changed, 734 insertions(+), 658 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/288351cc/CHANGELOG.asciidoc
----------------------------------------------------------------------
diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc
index 8282333..43a50c7 100644
--- a/CHANGELOG.asciidoc
+++ b/CHANGELOG.asciidoc
@@ -26,8 +26,9 @@ image::https://raw.githubusercontent.com/apache/tinkerpop/master/docs/static/ima
TinkerPop 3.3.0 (Release Date: NOT OFFICIALLY RELEASED YET)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-* Replaced term `REST` with `HTTP` to remove any confusion as to the design of the API
-
+* Replaced term `REST` with `HTTP` to remove any confusion as to the design of the API.
+* Moved `gremlin-benchmark` under `gremlin-tools` module.
+* Added `gremlin-tools` and its submodule `gremlin-coverage`.
[[release-3-2-3]]
TinkerPop 3.2.3 (Release Date: October 17, 2016)
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/288351cc/docs/src/dev/developer/development-environment.asciidoc
----------------------------------------------------------------------
diff --git a/docs/src/dev/developer/development-environment.asciidoc b/docs/src/dev/developer/development-environment.asciidoc
index ade4288..0b99647 100644
--- a/docs/src/dev/developer/development-environment.asciidoc
+++ b/docs/src/dev/developer/development-environment.asciidoc
@@ -146,6 +146,8 @@ mvn -Dmaven.javadoc.skip=true --projects tinkergraph-gremlin test
** Execute with the `-DuseEpoll` option to try to use Netty native transport (works on Linux, but will fallback to Java NIO on other OS).
* Performance Tests: `mvn verify -DskipPerformanceTests=false`
* Benchmarks: `mvn verify -DskipBenchmarks=false`
+* Test coverage report: `mvn clean install -Dcoverage` - note that the `install` is necessary because report aggregation is bound to that part of the lifecycle.
+** Reports are generated to `gremlin-tools/gremlin-coverage/target/site`
[[docker-integration]]
Docker Integration
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/288351cc/gremlin-benchmark/pom.xml
----------------------------------------------------------------------
diff --git a/gremlin-benchmark/pom.xml b/gremlin-benchmark/pom.xml
deleted file mode 100644
index 54272d5..0000000
--- a/gremlin-benchmark/pom.xml
+++ /dev/null
@@ -1,211 +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.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <artifactId>tinkerpop</artifactId>
- <groupId>org.apache.tinkerpop</groupId>
- <version>3.3.0-SNAPSHOT</version>
- </parent>
-
- <artifactId>gremlin-benchmark</artifactId>
- <name>Apache TinkerPop :: Gremlin Benchmark</name>
- <properties>
- <jmh.version>1.11.3</jmh.version>
- <!-- Skip benchmarks by default because they are time consuming. -->
- <skipBenchmarks>true</skipBenchmarks>
- <skipTests>${skipBenchmarks}</skipTests>
- </properties>
-
- <dependencies>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>compile</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.tinkerpop</groupId>
- <artifactId>gremlin-console</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.tinkerpop</groupId>
- <artifactId>gremlin-core</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.tinkerpop</groupId>
- <artifactId>gremlin-driver</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.tinkerpop</groupId>
- <artifactId>gremlin-groovy</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.tinkerpop</groupId>
- <artifactId>gremlin-python</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.tinkerpop</groupId>
- <artifactId>gremlin-server</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.tinkerpop</groupId>
- <artifactId>gremlin-test</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.tinkerpop</groupId>
- <artifactId>neo4j-gremlin</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.tinkerpop</groupId>
- <artifactId>tinkergraph-gremlin</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.openjdk.jmh</groupId>
- <artifactId>jmh-core</artifactId>
- <version>${jmh.version}</version>
- </dependency>
- <dependency>
- <groupId>org.openjdk.jmh</groupId>
- <artifactId>jmh-generator-annprocess</artifactId>
- <version>${jmh.version}</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- <optional>true</optional>
- </dependency>
- </dependencies>
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-deploy-plugin</artifactId>
- <configuration>
- <skip>true</skip>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <configuration>
- <testSourceDirectory>${project.build.sourceDirectory}</testSourceDirectory>
- <testClassesDirectory>${project.build.outputDirectory}</testClassesDirectory>
- <includes>
- <include>**/*Benchmark*.java</include>
- </includes>
- <excludes>
- <exclude>**/*$*.class</exclude>
- <exclude>**/Abstract*</exclude>
- <exclude>**/*_jmhType*</exclude>
- </excludes>
- <systemPropertyVariables>
- <benchmarkReportDir>${project.build.directory}/reports/benchmark/</benchmarkReportDir>
- </systemPropertyVariables>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-shade-plugin</artifactId>
- <version>2.2</version>
- <executions>
- <execution>
- <phase>package</phase>
- <goals>
- <goal>shade</goal>
- </goals>
- <configuration>
- <createDependencyReducedPom>false</createDependencyReducedPom>
- <transformers>
- <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
- <mainClass>org.openjdk.jmh.Main</mainClass>
- </transformer>
- </transformers>
- <filters>
- <filter>
- <artifact>*:*</artifact>
- <excludes>
- <exclude>META-INF/*.SF</exclude>
- <exclude>META-INF/*.DSA</exclude>
- <exclude>META-INF/*.RSA</exclude>
- </excludes>
- </filter>
- </filters>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
-
- <profiles>
- <profile>
- <id>coverage</id>
- <activation>
- <activeByDefault>false</activeByDefault>
- <property>
- <name>coverage</name>
- </property>
- </activation>
- <build>
- <plugins>
- <plugin>
- <groupId>org.jacoco</groupId>
- <artifactId>jacoco-maven-plugin</artifactId>
- <executions>
- <execution>
- <id>jacoco-report-aggregate</id>
- <phase>install</phase>
- <goals>
- <goal>report-aggregate</goal>
- </goals>
- <configuration>
- <title>Apache TinkerPop</title>
- <footer>Code Coverage Report for Apache TinkerPop ${project.version}</footer>
- <includes>
- <include>**/*.class</include>
- </includes>
- <excludes>
- <exclude>Lib/*.class</exclude>
- <exclude>Lib/aenum/**</exclude>
- <exclude>Lib/backports/**</exclude>
- <exclude>Lib/certifi/**</exclude>
- <exclude>Lib/setuptools/**</exclude>
- <exclude>Lib/setuptools.command/**</exclude>
- <exclude>Lib/tornado/**</exclude>
- <exclude>Lib/tornado.platform/**</exclude>
- <exclude>Lib/tornado.test/**</exclude>
- </excludes>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
- </profile>
- </profiles>
-</project>
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/288351cc/gremlin-benchmark/src/main/java/org/apache/tinkerpop/benchmark/util/AbstractBenchmarkBase.java
----------------------------------------------------------------------
diff --git a/gremlin-benchmark/src/main/java/org/apache/tinkerpop/benchmark/util/AbstractBenchmarkBase.java b/gremlin-benchmark/src/main/java/org/apache/tinkerpop/benchmark/util/AbstractBenchmarkBase.java
deleted file mode 100644
index 2f8bb66..0000000
--- a/gremlin-benchmark/src/main/java/org/apache/tinkerpop/benchmark/util/AbstractBenchmarkBase.java
+++ /dev/null
@@ -1,117 +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.benchmark.util;
-
-import org.junit.Test;
-import org.openjdk.jmh.annotations.Fork;
-import org.openjdk.jmh.annotations.Measurement;
-import org.openjdk.jmh.annotations.Warmup;
-import org.openjdk.jmh.results.format.ResultFormatType;
-import org.openjdk.jmh.runner.Runner;
-import org.openjdk.jmh.runner.options.ChainedOptionsBuilder;
-import org.openjdk.jmh.runner.options.OptionsBuilder;
-
-import java.io.File;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-
-/**
- * Base class for all TinkerPop OpenJDK JMH benchmarks. Based upon Netty's approach to running JMH benchmarks
- * from JUnit.
- *
- * @see <a href="http://netty.io/wiki/microbenchmarks.html"</a>
- *
- * @author Ted Wilmes (http://twilmes.org)
- */
-@Warmup(iterations = AbstractBenchmarkBase.DEFAULT_WARMUP_ITERATIONS)
-@Measurement(iterations = AbstractBenchmarkBase.DEFAULT_MEASURE_ITERATIONS)
-@Fork(AbstractBenchmarkBase.DEFAULT_FORKS)
-public abstract class AbstractBenchmarkBase {
-
- protected static final int DEFAULT_WARMUP_ITERATIONS = 10;
- protected static final int DEFAULT_MEASURE_ITERATIONS = 10;
- protected static final int DEFAULT_FORKS = 2;
- protected static final String DEFAULT_BENCHMARK_DIRECTORY = "./benchmarks/";
-
- protected static final String[] JVM_ARGS = {
- "-server", "-Xms2g", "-Xmx2g"
- };
-
- @Test
- public void run() throws Exception {
- final String className = getClass().getSimpleName();
-
- final ChainedOptionsBuilder runnerOptions = new OptionsBuilder()
- .include(".*" + className + ".*")
- .jvmArgs(JVM_ARGS);
-
- if (getWarmupIterations() > 0) {
- runnerOptions.warmupIterations(getWarmupIterations());
- }
-
- if (getMeasureIterations() > 0) {
- runnerOptions.measurementIterations(getMeasureIterations());
- }
-
- if (getForks() > 0) {
- runnerOptions.forks(getForks());
- }
-
- if (getReportDir() != null) {
- final String dtmStr = new SimpleDateFormat("yyyyMMddHHmmss").format(new Date());
- final String filePath = getReportDir() + className + "-" + dtmStr + ".json";
- final File file = new File(filePath);
- if (file.exists()) {
- file.delete();
- } else {
- file.getParentFile().mkdirs();
- file.createNewFile();
- }
-
- runnerOptions.resultFormat(ResultFormatType.JSON);
- runnerOptions.result(filePath);
- }
-
- new Runner(runnerOptions.build()).run();
- }
-
- protected int getWarmupIterations() {
- return getIntProperty("warmupIterations", DEFAULT_WARMUP_ITERATIONS);
- }
-
- protected int getMeasureIterations() {
- return getIntProperty("measureIterations", DEFAULT_MEASURE_ITERATIONS);
- }
-
- protected int getForks() {
- return getIntProperty("forks", DEFAULT_FORKS);
- }
-
- protected String getReportDir() {
- return System.getProperty("benchmark.dir", DEFAULT_BENCHMARK_DIRECTORY);
- }
-
- private int getIntProperty(final String propertyName, final int defaultValue) {
- final String propertyValue = System.getProperty(propertyName);
- if(propertyValue == null) {
- return defaultValue;
- }
- return Integer.valueOf(propertyValue);
- }
-}
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/288351cc/gremlin-benchmark/src/main/java/org/apache/tinkerpop/benchmark/util/AbstractGraphBenchmark.java
----------------------------------------------------------------------
diff --git a/gremlin-benchmark/src/main/java/org/apache/tinkerpop/benchmark/util/AbstractGraphBenchmark.java b/gremlin-benchmark/src/main/java/org/apache/tinkerpop/benchmark/util/AbstractGraphBenchmark.java
deleted file mode 100644
index ba0105c..0000000
--- a/gremlin-benchmark/src/main/java/org/apache/tinkerpop/benchmark/util/AbstractGraphBenchmark.java
+++ /dev/null
@@ -1,85 +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.benchmark.util;
-
-import org.apache.tinkerpop.gremlin.LoadGraphWith;
-import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
-import org.apache.tinkerpop.gremlin.structure.Graph;
-import org.apache.tinkerpop.gremlin.structure.io.GraphReader;
-import org.apache.tinkerpop.gremlin.structure.io.gryo.GryoReader;
-import org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerGraph;
-
-import org.openjdk.jmh.annotations.Scope;
-import org.openjdk.jmh.annotations.Setup;
-import org.openjdk.jmh.annotations.State;
-
-import java.io.IOException;
-import java.io.InputStream;
-
-/**
- * Read-only graph benchmarks extend {@code AbstractGraphBenchmark}. Annotating your benchmark class with {@link LoadGraphWith}
- * will load the {@link TinkerGraph} instance with the desired data set.
- *
- * @author Ted Wilmes (http://twilmes.org)
- */
-@State(Scope.Thread)
-public class AbstractGraphBenchmark extends AbstractBenchmarkBase {
-
- private final String PATH = "/org/apache/tinkerpop/gremlin/structure/io/gryo/";
-
- protected Graph graph;
- protected GraphTraversalSource g;
-
- /**
- * Opens a new {@link TinkerGraph} instance and optionally preloads it with one of the test data sets enumerated
- * in {@link LoadGraphWith}.
- *
- * @throws IOException on failure to load graph
- */
- @Setup
- public void prepare() throws IOException {
- graph = TinkerGraph.open();
- g = graph.traversal();
-
- final LoadGraphWith[] loadGraphWiths = this.getClass().getAnnotationsByType(LoadGraphWith.class);
- final LoadGraphWith loadGraphWith = loadGraphWiths.length == 0 ? null : loadGraphWiths[0];
- final LoadGraphWith.GraphData loadGraphWithData = null == loadGraphWith ? null : loadGraphWith.value();
-
- String graphFile;
- if(loadGraphWithData != null) {
- if (loadGraphWithData.equals(LoadGraphWith.GraphData.GRATEFUL)) {
- graphFile = "grateful-dead.kryo";
- } else if (loadGraphWithData.equals(LoadGraphWith.GraphData.MODERN)) {
- graphFile = "tinkerpop-modern.kryo";
- } else if (loadGraphWithData.equals(LoadGraphWith.GraphData.CLASSIC)) {
- graphFile = "tinkerpop-classic.kryo";
- } else if (loadGraphWithData.equals(LoadGraphWith.GraphData.CREW)) {
- graphFile = "tinkerpop-crew.kryo";
- } else {
- throw new RuntimeException("Could not load graph with " + loadGraphWithData);
- }
-
- final GraphReader reader = GryoReader.build().create();
- try (final InputStream stream = AbstractGraphBenchmark.class.
- getResourceAsStream(PATH + graphFile)) {
- reader.readGraph(stream, graph);
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/288351cc/gremlin-benchmark/src/main/java/org/apache/tinkerpop/benchmark/util/AbstractGraphMutateBenchmark.java
----------------------------------------------------------------------
diff --git a/gremlin-benchmark/src/main/java/org/apache/tinkerpop/benchmark/util/AbstractGraphMutateBenchmark.java b/gremlin-benchmark/src/main/java/org/apache/tinkerpop/benchmark/util/AbstractGraphMutateBenchmark.java
deleted file mode 100644
index 79d9916..0000000
--- a/gremlin-benchmark/src/main/java/org/apache/tinkerpop/benchmark/util/AbstractGraphMutateBenchmark.java
+++ /dev/null
@@ -1,48 +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.benchmark.util;
-
-import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
-import org.apache.tinkerpop.gremlin.structure.Graph;
-import org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerGraph;
-
-import org.openjdk.jmh.annotations.Level;
-import org.openjdk.jmh.annotations.Scope;
-import org.openjdk.jmh.annotations.Setup;
-import org.openjdk.jmh.annotations.State;
-
-/**
- * Graph write and update benchmarks extend {@code AbstractGraphMutateBenchmark}. {@code AbstractGraphMutateBenchmark}
- * runs setup once per invocation so that benchmark measurements are made on an empty {@link TinkerGraph}. This approach
- * was taken to isolate the tested method from the performance side effects of unbounded graph growth.
- *
- * @author Ted Wilmes (http://twilmes.org)
- */
-@State(Scope.Thread)
-public abstract class AbstractGraphMutateBenchmark extends AbstractBenchmarkBase {
-
- protected Graph graph;
- protected GraphTraversalSource g;
-
- @Setup(Level.Invocation)
- public void prepare() {
- graph = TinkerGraph.open();
- g = graph.traversal();
- }
-}
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/288351cc/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
deleted file mode 100644
index 04d7138..0000000
--- a/gremlin-benchmark/src/main/java/org/apache/tinkerpop/gremlin/process/GraphMutateBenchmark.java
+++ /dev/null
@@ -1,92 +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.process;
-
-import org.apache.tinkerpop.benchmark.util.AbstractGraphMutateBenchmark;
-import org.apache.tinkerpop.gremlin.structure.Edge;
-import org.apache.tinkerpop.gremlin.structure.Property;
-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;
-
-/**
- * {@code GraphMutateBenchmark} benchmarks {@link org.apache.tinkerpop.gremlin.process.traversal.Traversal} and
- * {@link org.apache.tinkerpop.gremlin.structure.Graph} mutation methods.
- *
- * @author Ted Wilmes (http://twilmes.org)
- */
-public class GraphMutateBenchmark extends AbstractGraphMutateBenchmark {
-
- private Vertex a;
- private Vertex b;
- private Vertex c;
- private Edge e;
-
- @Setup
- @Override
- public void prepare() {
- super.prepare();
- a = g.addV().next();
- b = g.addV().next();
- c = g.addV().next();
- e = b.addEdge("knows", c);
- }
-
- @Benchmark
- public Vertex testAddVertex() {
- return graph.addVertex("test");
- }
-
- @Benchmark
- public VertexProperty testVertexProperty() {
- return a.property("name", "Susan");
- }
-
- @Benchmark
- public Edge testAddEdge() {
- return a.addEdge("knows", b);
- }
-
- @Benchmark
- public Property testEdgeProperty() {
- return e.property("met", 1967);
- }
-
- @Benchmark
- public Vertex testAddV() {
- return g.addV("test").next();
- }
-
- @Benchmark
- public Vertex testVertexPropertyStep() {
- return g.V(a).property("name", "Susan").next();
- }
-
- @Benchmark
- public Edge testAddE() {
- return g.V(a).as("a").V(b).as("b").addE("knows").from("a").to("b").next();
- }
-
- @Benchmark
- public Edge testEdgePropertyStep() {
- return g.E(e).property("met", 1967).next();
- }
-}
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/288351cc/gremlin-benchmark/src/main/java/org/apache/tinkerpop/gremlin/process/GraphTraversalBenchmark.java
----------------------------------------------------------------------
diff --git a/gremlin-benchmark/src/main/java/org/apache/tinkerpop/gremlin/process/GraphTraversalBenchmark.java b/gremlin-benchmark/src/main/java/org/apache/tinkerpop/gremlin/process/GraphTraversalBenchmark.java
deleted file mode 100644
index 191f5e7..0000000
--- a/gremlin-benchmark/src/main/java/org/apache/tinkerpop/gremlin/process/GraphTraversalBenchmark.java
+++ /dev/null
@@ -1,101 +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.process;
-
-import org.apache.tinkerpop.benchmark.util.AbstractGraphBenchmark;
-import org.apache.tinkerpop.gremlin.LoadGraphWith;
-import org.apache.tinkerpop.gremlin.process.traversal.Path;
-import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__;
-import org.apache.tinkerpop.gremlin.structure.Edge;
-import org.apache.tinkerpop.gremlin.structure.Vertex;
-
-import org.openjdk.jmh.annotations.Benchmark;
-
-import java.util.List;
-import java.util.Map;
-
-import static org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__.out;
-
-/**
- * Runs a traversal benchmarks against a {@link org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerGraph} loaded
- * with the Grateful Dead data set.
- *
- * @author Ted Wilmes (http://twilmes.org)
- */
-@LoadGraphWith(LoadGraphWith.GraphData.GRATEFUL)
-public class GraphTraversalBenchmark extends AbstractGraphBenchmark {
-
- @Benchmark
- public List<Vertex> g_V_outE_inV_outE_inV_outE_inV() throws Exception {
- return g.V().outE().inV().outE().inV().outE().inV().toList();
- }
-
- @Benchmark
- public List<Vertex> g_V_out_out_out() throws Exception {
- return g.V().out().out().out().toList();
- }
-
- @Benchmark
- public List<Path> g_V_out_out_out_path() throws Exception {
- return g.V().out().out().out().path().toList();
- }
-
- @Benchmark
- public List<Vertex> g_V_repeatXoutX_timesX2X() throws Exception {
- return g.V().repeat(out()).times(2).toList();
- }
-
- @Benchmark
- public List<Vertex> g_V_repeatXoutX_timesX3X() throws Exception {
- return g.V().repeat(out()).times(3).toList();
- }
-
- @Benchmark
- public List<List<Object>> g_V_localXout_out_valuesXnameX_foldX() throws Exception {
- return g.V().local(out().out().values("name").fold()).toList();
- }
-
- @Benchmark
- public List<List<Object>> g_V_out_localXout_out_valuesXnameX_foldX() throws Exception {
- return g.V().out().local(out().out().values("name").fold()).toList();
- }
-
- @Benchmark
- public List<List<Object>> g_V_out_mapXout_out_valuesXnameX_toListX() throws Exception {
- return g.V().out().map(v -> g.V(v.get()).out().out().values("name").toList()).toList();
- }
-
- @Benchmark
- public List<Map<Object, Long>> g_V_label_groupCount() throws Exception {
- return g.V().label().groupCount().toList();
- }
-
- @Benchmark
- public List<Object> g_V_match_selectXbX_valuesXnameX() throws Exception {
- return g.V().match(
- __.as("a").has("name", "Garcia"),
- __.as("a").in("writtenBy").as("b"),
- __.as("a").in("sungBy").as("b")).select("b").values("name").toList();
- }
-
- @Benchmark
- public List<Edge> g_E_hasLabelXwrittenByX_whereXinV_inEXsungByX_count_isX0XX_subgraphXsgX() throws Exception {
- return g.E().hasLabel("writtenBy").where(__.inV().inE("sungBy").count().is(0)).subgraph("sg").toList();
- }
-}
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/288351cc/gremlin-test/pom.xml
----------------------------------------------------------------------
diff --git a/gremlin-test/pom.xml b/gremlin-test/pom.xml
index 705cfaa..76c4d4b 100644
--- a/gremlin-test/pom.xml
+++ b/gremlin-test/pom.xml
@@ -91,6 +91,7 @@ limitations under the License.
</plugins>
</build>
+ <!-- for whatever reason, jacoco doesn't like running the TraversalInterruptionTest - ignore for now -->
<profiles>
<profile>
<id>coverage</id>
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/288351cc/gremlin-tools/gremlin-benchmark/pom.xml
----------------------------------------------------------------------
diff --git a/gremlin-tools/gremlin-benchmark/pom.xml b/gremlin-tools/gremlin-benchmark/pom.xml
new file mode 100644
index 0000000..7ea7463
--- /dev/null
+++ b/gremlin-tools/gremlin-benchmark/pom.xml
@@ -0,0 +1,134 @@
+<!--
+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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <artifactId>tinkerpop</artifactId>
+ <groupId>org.apache.tinkerpop</groupId>
+ <version>3.3.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>gremlin-benchmark</artifactId>
+ <name>Apache TinkerPop :: Gremlin Benchmark</name>
+ <properties>
+ <jmh.version>1.11.3</jmh.version>
+ <!-- Skip benchmarks by default because they are time consuming. -->
+ <skipBenchmarks>true</skipBenchmarks>
+ <skipTests>${skipBenchmarks}</skipTests>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tinkerpop</groupId>
+ <artifactId>gremlin-core</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tinkerpop</groupId>
+ <artifactId>gremlin-test</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tinkerpop</groupId>
+ <artifactId>tinkergraph-gremlin</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.openjdk.jmh</groupId>
+ <artifactId>jmh-core</artifactId>
+ <version>${jmh.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.openjdk.jmh</groupId>
+ <artifactId>jmh-generator-annprocess</artifactId>
+ <version>${jmh.version}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-log4j12</artifactId>
+ <optional>true</optional>
+ </dependency>
+ </dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-deploy-plugin</artifactId>
+ <configuration>
+ <skip>true</skip>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <testSourceDirectory>${project.build.sourceDirectory}</testSourceDirectory>
+ <testClassesDirectory>${project.build.outputDirectory}</testClassesDirectory>
+ <includes>
+ <include>**/*Benchmark*.java</include>
+ </includes>
+ <excludes>
+ <exclude>**/*$*.class</exclude>
+ <exclude>**/Abstract*</exclude>
+ <exclude>**/*_jmhType*</exclude>
+ </excludes>
+ <systemPropertyVariables>
+ <benchmarkReportDir>${project.build.directory}/reports/benchmark/</benchmarkReportDir>
+ </systemPropertyVariables>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-shade-plugin</artifactId>
+ <version>2.2</version>
+ <executions>
+ <execution>
+ <phase>package</phase>
+ <goals>
+ <goal>shade</goal>
+ </goals>
+ <configuration>
+ <createDependencyReducedPom>false</createDependencyReducedPom>
+ <transformers>
+ <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
+ <mainClass>org.openjdk.jmh.Main</mainClass>
+ </transformer>
+ </transformers>
+ <filters>
+ <filter>
+ <artifact>*:*</artifact>
+ <excludes>
+ <exclude>META-INF/*.SF</exclude>
+ <exclude>META-INF/*.DSA</exclude>
+ <exclude>META-INF/*.RSA</exclude>
+ </excludes>
+ </filter>
+ </filters>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/288351cc/gremlin-tools/gremlin-benchmark/src/main/java/org/apache/tinkerpop/benchmark/util/AbstractBenchmarkBase.java
----------------------------------------------------------------------
diff --git a/gremlin-tools/gremlin-benchmark/src/main/java/org/apache/tinkerpop/benchmark/util/AbstractBenchmarkBase.java b/gremlin-tools/gremlin-benchmark/src/main/java/org/apache/tinkerpop/benchmark/util/AbstractBenchmarkBase.java
new file mode 100644
index 0000000..2f8bb66
--- /dev/null
+++ b/gremlin-tools/gremlin-benchmark/src/main/java/org/apache/tinkerpop/benchmark/util/AbstractBenchmarkBase.java
@@ -0,0 +1,117 @@
+/*
+ * 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.benchmark.util;
+
+import org.junit.Test;
+import org.openjdk.jmh.annotations.Fork;
+import org.openjdk.jmh.annotations.Measurement;
+import org.openjdk.jmh.annotations.Warmup;
+import org.openjdk.jmh.results.format.ResultFormatType;
+import org.openjdk.jmh.runner.Runner;
+import org.openjdk.jmh.runner.options.ChainedOptionsBuilder;
+import org.openjdk.jmh.runner.options.OptionsBuilder;
+
+import java.io.File;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+/**
+ * Base class for all TinkerPop OpenJDK JMH benchmarks. Based upon Netty's approach to running JMH benchmarks
+ * from JUnit.
+ *
+ * @see <a href="http://netty.io/wiki/microbenchmarks.html"</a>
+ *
+ * @author Ted Wilmes (http://twilmes.org)
+ */
+@Warmup(iterations = AbstractBenchmarkBase.DEFAULT_WARMUP_ITERATIONS)
+@Measurement(iterations = AbstractBenchmarkBase.DEFAULT_MEASURE_ITERATIONS)
+@Fork(AbstractBenchmarkBase.DEFAULT_FORKS)
+public abstract class AbstractBenchmarkBase {
+
+ protected static final int DEFAULT_WARMUP_ITERATIONS = 10;
+ protected static final int DEFAULT_MEASURE_ITERATIONS = 10;
+ protected static final int DEFAULT_FORKS = 2;
+ protected static final String DEFAULT_BENCHMARK_DIRECTORY = "./benchmarks/";
+
+ protected static final String[] JVM_ARGS = {
+ "-server", "-Xms2g", "-Xmx2g"
+ };
+
+ @Test
+ public void run() throws Exception {
+ final String className = getClass().getSimpleName();
+
+ final ChainedOptionsBuilder runnerOptions = new OptionsBuilder()
+ .include(".*" + className + ".*")
+ .jvmArgs(JVM_ARGS);
+
+ if (getWarmupIterations() > 0) {
+ runnerOptions.warmupIterations(getWarmupIterations());
+ }
+
+ if (getMeasureIterations() > 0) {
+ runnerOptions.measurementIterations(getMeasureIterations());
+ }
+
+ if (getForks() > 0) {
+ runnerOptions.forks(getForks());
+ }
+
+ if (getReportDir() != null) {
+ final String dtmStr = new SimpleDateFormat("yyyyMMddHHmmss").format(new Date());
+ final String filePath = getReportDir() + className + "-" + dtmStr + ".json";
+ final File file = new File(filePath);
+ if (file.exists()) {
+ file.delete();
+ } else {
+ file.getParentFile().mkdirs();
+ file.createNewFile();
+ }
+
+ runnerOptions.resultFormat(ResultFormatType.JSON);
+ runnerOptions.result(filePath);
+ }
+
+ new Runner(runnerOptions.build()).run();
+ }
+
+ protected int getWarmupIterations() {
+ return getIntProperty("warmupIterations", DEFAULT_WARMUP_ITERATIONS);
+ }
+
+ protected int getMeasureIterations() {
+ return getIntProperty("measureIterations", DEFAULT_MEASURE_ITERATIONS);
+ }
+
+ protected int getForks() {
+ return getIntProperty("forks", DEFAULT_FORKS);
+ }
+
+ protected String getReportDir() {
+ return System.getProperty("benchmark.dir", DEFAULT_BENCHMARK_DIRECTORY);
+ }
+
+ private int getIntProperty(final String propertyName, final int defaultValue) {
+ final String propertyValue = System.getProperty(propertyName);
+ if(propertyValue == null) {
+ return defaultValue;
+ }
+ return Integer.valueOf(propertyValue);
+ }
+}
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/288351cc/gremlin-tools/gremlin-benchmark/src/main/java/org/apache/tinkerpop/benchmark/util/AbstractGraphBenchmark.java
----------------------------------------------------------------------
diff --git a/gremlin-tools/gremlin-benchmark/src/main/java/org/apache/tinkerpop/benchmark/util/AbstractGraphBenchmark.java b/gremlin-tools/gremlin-benchmark/src/main/java/org/apache/tinkerpop/benchmark/util/AbstractGraphBenchmark.java
new file mode 100644
index 0000000..ba0105c
--- /dev/null
+++ b/gremlin-tools/gremlin-benchmark/src/main/java/org/apache/tinkerpop/benchmark/util/AbstractGraphBenchmark.java
@@ -0,0 +1,85 @@
+/*
+ * 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.benchmark.util;
+
+import org.apache.tinkerpop.gremlin.LoadGraphWith;
+import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
+import org.apache.tinkerpop.gremlin.structure.Graph;
+import org.apache.tinkerpop.gremlin.structure.io.GraphReader;
+import org.apache.tinkerpop.gremlin.structure.io.gryo.GryoReader;
+import org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerGraph;
+
+import org.openjdk.jmh.annotations.Scope;
+import org.openjdk.jmh.annotations.Setup;
+import org.openjdk.jmh.annotations.State;
+
+import java.io.IOException;
+import java.io.InputStream;
+
+/**
+ * Read-only graph benchmarks extend {@code AbstractGraphBenchmark}. Annotating your benchmark class with {@link LoadGraphWith}
+ * will load the {@link TinkerGraph} instance with the desired data set.
+ *
+ * @author Ted Wilmes (http://twilmes.org)
+ */
+@State(Scope.Thread)
+public class AbstractGraphBenchmark extends AbstractBenchmarkBase {
+
+ private final String PATH = "/org/apache/tinkerpop/gremlin/structure/io/gryo/";
+
+ protected Graph graph;
+ protected GraphTraversalSource g;
+
+ /**
+ * Opens a new {@link TinkerGraph} instance and optionally preloads it with one of the test data sets enumerated
+ * in {@link LoadGraphWith}.
+ *
+ * @throws IOException on failure to load graph
+ */
+ @Setup
+ public void prepare() throws IOException {
+ graph = TinkerGraph.open();
+ g = graph.traversal();
+
+ final LoadGraphWith[] loadGraphWiths = this.getClass().getAnnotationsByType(LoadGraphWith.class);
+ final LoadGraphWith loadGraphWith = loadGraphWiths.length == 0 ? null : loadGraphWiths[0];
+ final LoadGraphWith.GraphData loadGraphWithData = null == loadGraphWith ? null : loadGraphWith.value();
+
+ String graphFile;
+ if(loadGraphWithData != null) {
+ if (loadGraphWithData.equals(LoadGraphWith.GraphData.GRATEFUL)) {
+ graphFile = "grateful-dead.kryo";
+ } else if (loadGraphWithData.equals(LoadGraphWith.GraphData.MODERN)) {
+ graphFile = "tinkerpop-modern.kryo";
+ } else if (loadGraphWithData.equals(LoadGraphWith.GraphData.CLASSIC)) {
+ graphFile = "tinkerpop-classic.kryo";
+ } else if (loadGraphWithData.equals(LoadGraphWith.GraphData.CREW)) {
+ graphFile = "tinkerpop-crew.kryo";
+ } else {
+ throw new RuntimeException("Could not load graph with " + loadGraphWithData);
+ }
+
+ final GraphReader reader = GryoReader.build().create();
+ try (final InputStream stream = AbstractGraphBenchmark.class.
+ getResourceAsStream(PATH + graphFile)) {
+ reader.readGraph(stream, graph);
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/288351cc/gremlin-tools/gremlin-benchmark/src/main/java/org/apache/tinkerpop/benchmark/util/AbstractGraphMutateBenchmark.java
----------------------------------------------------------------------
diff --git a/gremlin-tools/gremlin-benchmark/src/main/java/org/apache/tinkerpop/benchmark/util/AbstractGraphMutateBenchmark.java b/gremlin-tools/gremlin-benchmark/src/main/java/org/apache/tinkerpop/benchmark/util/AbstractGraphMutateBenchmark.java
new file mode 100644
index 0000000..79d9916
--- /dev/null
+++ b/gremlin-tools/gremlin-benchmark/src/main/java/org/apache/tinkerpop/benchmark/util/AbstractGraphMutateBenchmark.java
@@ -0,0 +1,48 @@
+/*
+ * 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.benchmark.util;
+
+import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
+import org.apache.tinkerpop.gremlin.structure.Graph;
+import org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerGraph;
+
+import org.openjdk.jmh.annotations.Level;
+import org.openjdk.jmh.annotations.Scope;
+import org.openjdk.jmh.annotations.Setup;
+import org.openjdk.jmh.annotations.State;
+
+/**
+ * Graph write and update benchmarks extend {@code AbstractGraphMutateBenchmark}. {@code AbstractGraphMutateBenchmark}
+ * runs setup once per invocation so that benchmark measurements are made on an empty {@link TinkerGraph}. This approach
+ * was taken to isolate the tested method from the performance side effects of unbounded graph growth.
+ *
+ * @author Ted Wilmes (http://twilmes.org)
+ */
+@State(Scope.Thread)
+public abstract class AbstractGraphMutateBenchmark extends AbstractBenchmarkBase {
+
+ protected Graph graph;
+ protected GraphTraversalSource g;
+
+ @Setup(Level.Invocation)
+ public void prepare() {
+ graph = TinkerGraph.open();
+ g = graph.traversal();
+ }
+}
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/288351cc/gremlin-tools/gremlin-benchmark/src/main/java/org/apache/tinkerpop/gremlin/process/GraphMutateBenchmark.java
----------------------------------------------------------------------
diff --git a/gremlin-tools/gremlin-benchmark/src/main/java/org/apache/tinkerpop/gremlin/process/GraphMutateBenchmark.java b/gremlin-tools/gremlin-benchmark/src/main/java/org/apache/tinkerpop/gremlin/process/GraphMutateBenchmark.java
new file mode 100644
index 0000000..04d7138
--- /dev/null
+++ b/gremlin-tools/gremlin-benchmark/src/main/java/org/apache/tinkerpop/gremlin/process/GraphMutateBenchmark.java
@@ -0,0 +1,92 @@
+/*
+ * 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;
+
+import org.apache.tinkerpop.benchmark.util.AbstractGraphMutateBenchmark;
+import org.apache.tinkerpop.gremlin.structure.Edge;
+import org.apache.tinkerpop.gremlin.structure.Property;
+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;
+
+/**
+ * {@code GraphMutateBenchmark} benchmarks {@link org.apache.tinkerpop.gremlin.process.traversal.Traversal} and
+ * {@link org.apache.tinkerpop.gremlin.structure.Graph} mutation methods.
+ *
+ * @author Ted Wilmes (http://twilmes.org)
+ */
+public class GraphMutateBenchmark extends AbstractGraphMutateBenchmark {
+
+ private Vertex a;
+ private Vertex b;
+ private Vertex c;
+ private Edge e;
+
+ @Setup
+ @Override
+ public void prepare() {
+ super.prepare();
+ a = g.addV().next();
+ b = g.addV().next();
+ c = g.addV().next();
+ e = b.addEdge("knows", c);
+ }
+
+ @Benchmark
+ public Vertex testAddVertex() {
+ return graph.addVertex("test");
+ }
+
+ @Benchmark
+ public VertexProperty testVertexProperty() {
+ return a.property("name", "Susan");
+ }
+
+ @Benchmark
+ public Edge testAddEdge() {
+ return a.addEdge("knows", b);
+ }
+
+ @Benchmark
+ public Property testEdgeProperty() {
+ return e.property("met", 1967);
+ }
+
+ @Benchmark
+ public Vertex testAddV() {
+ return g.addV("test").next();
+ }
+
+ @Benchmark
+ public Vertex testVertexPropertyStep() {
+ return g.V(a).property("name", "Susan").next();
+ }
+
+ @Benchmark
+ public Edge testAddE() {
+ return g.V(a).as("a").V(b).as("b").addE("knows").from("a").to("b").next();
+ }
+
+ @Benchmark
+ public Edge testEdgePropertyStep() {
+ return g.E(e).property("met", 1967).next();
+ }
+}
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/288351cc/gremlin-tools/gremlin-benchmark/src/main/java/org/apache/tinkerpop/gremlin/process/GraphTraversalBenchmark.java
----------------------------------------------------------------------
diff --git a/gremlin-tools/gremlin-benchmark/src/main/java/org/apache/tinkerpop/gremlin/process/GraphTraversalBenchmark.java b/gremlin-tools/gremlin-benchmark/src/main/java/org/apache/tinkerpop/gremlin/process/GraphTraversalBenchmark.java
new file mode 100644
index 0000000..191f5e7
--- /dev/null
+++ b/gremlin-tools/gremlin-benchmark/src/main/java/org/apache/tinkerpop/gremlin/process/GraphTraversalBenchmark.java
@@ -0,0 +1,101 @@
+/*
+ * 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;
+
+import org.apache.tinkerpop.benchmark.util.AbstractGraphBenchmark;
+import org.apache.tinkerpop.gremlin.LoadGraphWith;
+import org.apache.tinkerpop.gremlin.process.traversal.Path;
+import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__;
+import org.apache.tinkerpop.gremlin.structure.Edge;
+import org.apache.tinkerpop.gremlin.structure.Vertex;
+
+import org.openjdk.jmh.annotations.Benchmark;
+
+import java.util.List;
+import java.util.Map;
+
+import static org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__.out;
+
+/**
+ * Runs a traversal benchmarks against a {@link org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerGraph} loaded
+ * with the Grateful Dead data set.
+ *
+ * @author Ted Wilmes (http://twilmes.org)
+ */
+@LoadGraphWith(LoadGraphWith.GraphData.GRATEFUL)
+public class GraphTraversalBenchmark extends AbstractGraphBenchmark {
+
+ @Benchmark
+ public List<Vertex> g_V_outE_inV_outE_inV_outE_inV() throws Exception {
+ return g.V().outE().inV().outE().inV().outE().inV().toList();
+ }
+
+ @Benchmark
+ public List<Vertex> g_V_out_out_out() throws Exception {
+ return g.V().out().out().out().toList();
+ }
+
+ @Benchmark
+ public List<Path> g_V_out_out_out_path() throws Exception {
+ return g.V().out().out().out().path().toList();
+ }
+
+ @Benchmark
+ public List<Vertex> g_V_repeatXoutX_timesX2X() throws Exception {
+ return g.V().repeat(out()).times(2).toList();
+ }
+
+ @Benchmark
+ public List<Vertex> g_V_repeatXoutX_timesX3X() throws Exception {
+ return g.V().repeat(out()).times(3).toList();
+ }
+
+ @Benchmark
+ public List<List<Object>> g_V_localXout_out_valuesXnameX_foldX() throws Exception {
+ return g.V().local(out().out().values("name").fold()).toList();
+ }
+
+ @Benchmark
+ public List<List<Object>> g_V_out_localXout_out_valuesXnameX_foldX() throws Exception {
+ return g.V().out().local(out().out().values("name").fold()).toList();
+ }
+
+ @Benchmark
+ public List<List<Object>> g_V_out_mapXout_out_valuesXnameX_toListX() throws Exception {
+ return g.V().out().map(v -> g.V(v.get()).out().out().values("name").toList()).toList();
+ }
+
+ @Benchmark
+ public List<Map<Object, Long>> g_V_label_groupCount() throws Exception {
+ return g.V().label().groupCount().toList();
+ }
+
+ @Benchmark
+ public List<Object> g_V_match_selectXbX_valuesXnameX() throws Exception {
+ return g.V().match(
+ __.as("a").has("name", "Garcia"),
+ __.as("a").in("writtenBy").as("b"),
+ __.as("a").in("sungBy").as("b")).select("b").values("name").toList();
+ }
+
+ @Benchmark
+ public List<Edge> g_E_hasLabelXwrittenByX_whereXinV_inEXsungByX_count_isX0XX_subgraphXsgX() throws Exception {
+ return g.E().hasLabel("writtenBy").where(__.inV().inE("sungBy").count().is(0)).subgraph("sg").toList();
+ }
+}
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/288351cc/gremlin-tools/gremlin-coverage/pom.xml
----------------------------------------------------------------------
diff --git a/gremlin-tools/gremlin-coverage/pom.xml b/gremlin-tools/gremlin-coverage/pom.xml
new file mode 100644
index 0000000..b0172d8
--- /dev/null
+++ b/gremlin-tools/gremlin-coverage/pom.xml
@@ -0,0 +1,118 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <artifactId>gremlin-tools</artifactId>
+ <groupId>org.apache.tinkerpop</groupId>
+ <version>3.3.0-SNAPSHOT</version>
+ </parent>
+ <artifactId>gremlin-coverage</artifactId>
+ <name>Apache TinkerPop :: Gremlin Coverage</name>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tinkerpop</groupId>
+ <artifactId>gremlin-console</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tinkerpop</groupId>
+ <artifactId>gremlin-core</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tinkerpop</groupId>
+ <artifactId>gremlin-driver</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tinkerpop</groupId>
+ <artifactId>gremlin-groovy</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tinkerpop</groupId>
+ <artifactId>gremlin-python</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tinkerpop</groupId>
+ <artifactId>gremlin-server</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tinkerpop</groupId>
+ <artifactId>neo4j-gremlin</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tinkerpop</groupId>
+ <artifactId>tinkergraph-gremlin</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-log4j12</artifactId>
+ <optional>true</optional>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-deploy-plugin</artifactId>
+ <configuration>
+ <skip>true</skip>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+ <profiles>
+ <profile>
+ <id>coverage</id>
+ <activation>
+ <activeByDefault>false</activeByDefault>
+ <property>
+ <name>coverage</name>
+ </property>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.jacoco</groupId>
+ <artifactId>jacoco-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>jacoco-report-aggregate</id>
+ <phase>install</phase>
+ <goals>
+ <goal>report-aggregate</goal>
+ </goals>
+ <configuration>
+ <title>Apache TinkerPop</title>
+ <footer>Code Coverage Report for Apache TinkerPop ${project.version}</footer>
+ <includes>
+ <include>**/*.class</include>
+ </includes>
+ <excludes>
+ <exclude>Lib/*.class</exclude>
+ <exclude>Lib/aenum/**</exclude>
+ <exclude>Lib/backports/**</exclude>
+ <exclude>Lib/certifi/**</exclude>
+ <exclude>Lib/setuptools/**</exclude>
+ <exclude>Lib/setuptools.command/**</exclude>
+ <exclude>Lib/tornado/**</exclude>
+ <exclude>Lib/tornado.platform/**</exclude>
+ <exclude>Lib/tornado.test/**</exclude>
+ </excludes>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+</project>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/288351cc/gremlin-tools/pom.xml
----------------------------------------------------------------------
diff --git a/gremlin-tools/pom.xml b/gremlin-tools/pom.xml
new file mode 100644
index 0000000..98857bb
--- /dev/null
+++ b/gremlin-tools/pom.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <artifactId>tinkerpop</artifactId>
+ <groupId>org.apache.tinkerpop</groupId>
+ <version>3.3.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>gremlin-tools</artifactId>
+ <name>Apache TinkerPop :: Gremlin Tools</name>
+ <packaging>pom</packaging>
+ <modules>
+ <module>gremlin-benchmark</module>
+ <module>gremlin-coverage</module>
+ </modules>
+
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-deploy-plugin</artifactId>
+ <configuration>
+ <skip>true</skip>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/288351cc/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index f660e51..c2cc89d 100644
--- a/pom.xml
+++ b/pom.xml
@@ -113,7 +113,6 @@ limitations under the License.
<module>gremlin-shaded</module>
<module>gremlin-core</module>
<module>gremlin-test</module>
- <module>gremlin-benchmark</module>
<module>gremlin-groovy</module>
<module>gremlin-groovy-test</module>
<module>tinkergraph-gremlin</module>
@@ -126,6 +125,7 @@ limitations under the License.
<module>gremlin-console</module>
<module>gremlin-server</module>
<module>gremlin-archetype</module>
+ <module>gremlin-tools</module>
</modules>
<scm>
<connection>scm:git:git@git-wip-us.apache.org:repos/asf/tinkerpop.git</connection>
@@ -1237,7 +1237,7 @@ limitations under the License.
<goal>prepare-agent</goal>
</goals>
<configuration>
- <destFile>${session.executionRootDirectory}/target/jacoco-it.exec</destFile>
+ <destFile>target/jacoco-it.exec</destFile>
<append>true</append>
<propertyName>failsafeArgLine</propertyName>
</configuration>