This is an automated email from the ASF dual-hosted git repository.
kturner pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/accumulo-access.git
The following commit(s) were added to refs/heads/main by this push:
new 2a41f0e Adds benchmark for creating parse trees (#97)
2a41f0e is described below
commit 2a41f0ec9c5b5bdd62f2d35efda303d2574bd1bf
Author: Keith Turner <[email protected]>
AuthorDate: Wed Jan 7 12:47:09 2026 -0800
Adds benchmark for creating parse trees (#97)
Also updates comments in the benchmark that were incorrect. The
comments were based on how the code used to work.
---
.../access/tests/AccessExpressionBenchmark.java | 19 +++++++++++++++----
1 file changed, 15 insertions(+), 4 deletions(-)
diff --git
a/core/src/test/java/org/apache/accumulo/access/tests/AccessExpressionBenchmark.java
b/core/src/test/java/org/apache/accumulo/access/tests/AccessExpressionBenchmark.java
index 64de076..b9706b2 100644
---
a/core/src/test/java/org/apache/accumulo/access/tests/AccessExpressionBenchmark.java
+++
b/core/src/test/java/org/apache/accumulo/access/tests/AccessExpressionBenchmark.java
@@ -31,6 +31,7 @@ import java.util.stream.Stream;
import org.apache.accumulo.access.AccessEvaluator;
import org.apache.accumulo.access.AccessExpression;
import org.apache.accumulo.access.Authorizations;
+import org.apache.accumulo.access.ParsedAccessExpression;
import org.apache.accumulo.core.security.ColumnVisibility;
import org.apache.accumulo.core.security.VisibilityEvaluator;
import org.apache.accumulo.core.security.VisibilityParseException;
@@ -163,7 +164,7 @@ public class AccessExpressionBenchmark {
}
/**
- * Measures the time it takes to parse an expression stored in byte[] and
produce a parse tree.
+ * Measures the time it takes to parse an expression stored in byte[] and
validate it.
*/
@Benchmark
public void measureBytesValidation(BenchmarkState state, Blackhole
blackhole) {
@@ -173,7 +174,7 @@ public class AccessExpressionBenchmark {
}
/**
- * Measures the time it takes to parse an expression stored in a String and
produce a parse tree.
+ * Measures the time it takes to parse an expression stored in a String and
validate it.
*/
@Benchmark
public void measureStringValidation(BenchmarkState state, Blackhole
blackhole) {
@@ -183,8 +184,18 @@ public class AccessExpressionBenchmark {
}
/**
- * Measures the time it takes to parse and evaluate an expression. This has
to create the parse
- * tree an operate on it.
+ * Measures the time it takes to parse an expression stored in a String and
produce a parse tree.
+ *
+ */
+ @Benchmark
+ public void measureCreateParseTree(BenchmarkState state, Blackhole
blackhole) {
+ for (String accessExpression : state.getStringExpressions()) {
+ blackhole.consume(ParsedAccessExpression.parse(accessExpression));
+ }
+ }
+
+ /**
+ * Measures the time it takes to evaluate an expression.
*/
@Benchmark
public void measureParseAndEvaluation(BenchmarkState state, Blackhole
blackhole) {