This is an automated email from the ASF dual-hosted git repository.

andreac pushed a commit to branch 3.8-dev
in repository https://gitbox.apache.org/repos/asf/tinkerpop.git


The following commit(s) were added to refs/heads/3.8-dev by this push:
     new f67ba022a8 Changed ApplyStrategiesBenchmark to apply default 
strategies (#3236)
f67ba022a8 is described below

commit f67ba022a880d6779f806074839e400d39f07330
Author: andreachild <[email protected]>
AuthorDate: Tue Oct 14 11:42:15 2025 -0700

    Changed ApplyStrategiesBenchmark to apply default strategies (#3236)
    
    Changed ApplyStrategiesBenchmark.java traversal source to apply default 
strategies from the global cache otherwise EmptyGraph does not apply any 
strategies. Added verification that at least one strategy is applied, failing 
the benchmark otherwise. Enabled the shouldFailOnError option of the benchmark 
configuration to prevent the benchmark tests from producing misleading results 
if the tests were actually throwing errors.
---
 .../benchmark/util/AbstractBenchmarkBase.java          |  2 ++
 .../gremlin/process/ApplyStrategiesBenchmark.java      | 18 +++++++++++++++++-
 2 files changed, 19 insertions(+), 1 deletion(-)

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
index 19be33637e..4e9c218bab 100644
--- 
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
@@ -56,6 +56,8 @@ public abstract class AbstractBenchmarkBase {
 
         final ChainedOptionsBuilder runnerOptions = new OptionsBuilder()
                 .include(".*" + className + ".*")
+                // fail on error otherwise the benchmark results could be 
misleading
+                .shouldFailOnError(true)
                 .jvmArgs(getJvmArgs());
 
         if (getWarmupIterations() > 0) {
diff --git 
a/gremlin-tools/gremlin-benchmark/src/main/java/org/apache/tinkerpop/gremlin/process/ApplyStrategiesBenchmark.java
 
b/gremlin-tools/gremlin-benchmark/src/main/java/org/apache/tinkerpop/gremlin/process/ApplyStrategiesBenchmark.java
index fab8d436ce..ff460dc218 100644
--- 
a/gremlin-tools/gremlin-benchmark/src/main/java/org/apache/tinkerpop/gremlin/process/ApplyStrategiesBenchmark.java
+++ 
b/gremlin-tools/gremlin-benchmark/src/main/java/org/apache/tinkerpop/gremlin/process/ApplyStrategiesBenchmark.java
@@ -18,9 +18,12 @@
  */
 package org.apache.tinkerpop.gremlin.process;
 
+import java.util.List;
 import org.apache.tinkerpop.benchmark.util.AbstractBenchmarkBase;
 import org.apache.tinkerpop.gremlin.process.traversal.P;
 import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
+import org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategies;
+import org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategy;
 import 
org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
 import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__;
 import org.apache.tinkerpop.gremlin.structure.Graph;
@@ -46,8 +49,21 @@ import static 
org.apache.tinkerpop.gremlin.process.traversal.AnonymousTraversalS
 public class ApplyStrategiesBenchmark extends AbstractBenchmarkBase {
 
     private Graph graph = EmptyGraph.instance();
-    private GraphTraversalSource g = traversal().withEmbedded(graph);
+    private GraphTraversalSource g = traversal().withEmbedded(graph)
+           
.withStrategies(TraversalStrategies.GlobalCache.getStrategies(Graph.class).toList().toArray(new
 TraversalStrategy[0]));
     private Traversal<?, ?> traversal;
+    
+    @Setup(Level.Trial)
+    public void setUpTrial() {
+        // ensure there are strategies registered
+        List<TraversalStrategy<?>> strategies = g.getStrategies().toList();
+        if (strategies.isEmpty()) {
+            throw new IllegalStateException("No traversal strategies are 
registered");
+        }
+        // output the strategies that were registered for the benchmark
+        System.out.println();
+        System.out.println("Strategies: " + strategies);
+    }
 
     /**
      * Setup method that constructs the complex traversal before benchmarking 
on each invocation of the test.

Reply via email to