d8tltanc commented on a change in pull request #9485:
URL: https://github.com/apache/kafka/pull/9485#discussion_r534477631



##########
File path: 
jmh-benchmarks/src/main/java/org/apache/kafka/jmh/acl/AclAuthorizerBenchmark.java
##########
@@ -69,33 +70,39 @@
 @BenchmarkMode(Mode.AverageTime)
 @OutputTimeUnit(TimeUnit.MILLISECONDS)
 public class AclAuthorizerBenchmark {
-    @Param({"10000", "50000", "200000"})
+    @Param({"10000", "40000", "80000"})

Review comment:
        I just realized that my AclAuthorizer implementation is calling 
`String::startWith` which also has an O(d) complexity where `d` is the length 
of the "deny pattern" string of the given ACL. So the complexity would be O(n * 
m * d). This means that iterating through all the prefixes of the `allow 
pattern` and check if any prefix is contained in the `deny pattern set` will be 
much faster, with a complexity of O(n * a), where `a` is the length of the 
"allow pattern" string, which should be very close to `d`. So we can say that 
O(n * a) < O(n * m * d). (this is what the interface default do). I'll just 
change the AclAuthorizer to use the same mechanism as the interface default.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to