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



##########
File path: 
jmh-benchmarks/src/main/java/org/apache/kafka/jmh/acl/AclAuthorizerBenchmark.java
##########
@@ -164,4 +206,28 @@ public void testAclsIterator() {
     public void testAuthorizer() {
         aclAuthorizer.authorize(context, actions);
     }
+
+    @Benchmark
+    public void testAuthorizeByResourceType() {
+        aclAuthorizer.authorizeByResourceType(context, AclOperation.WRITE, 
ResourceType.TOPIC);
+    }
+
+    @Benchmark
+    public void testUpdateCache() {
+        AclAuthorizer aclAuthorizer = new AclAuthorizer();
+        scala.collection.mutable.Set<AclEntry> entries = new 
scala.collection.mutable.HashSet<>();
+        for (int i = 0; i < resourceCount; i ++){
+            scala.collection.immutable.Set<AclEntry> immutable = new 
scala.collection.immutable.HashSet<>();
+            for (int j = 0; j < aclCount; j++) {
+                entries.add(new AclEntry(new AccessControlEntry(
+                    principal.toString(), "127.0.0" + j, AclOperation.WRITE, 
AclPermissionType.ALLOW)));
+                immutable = entries.toSet();
+            }
+            aclAuthorizer.updateCache(

Review comment:
       It might be better for the purpose of this microbenchmark to setup the 
cache with the desired size ahead of the time and then measure the time to 
update the cache with one entry. Otherwise you risk measuring a lot of the 
setup costs rather than the cost of the typical usage.




----------------------------------------------------------------
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