d8tltanc commented on a change in pull request #9485: URL: https://github.com/apache/kafka/pull/9485#discussion_r538618149
########## 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: @rajinisivaram Do you think we'll keep this `testUpdateCache` and merge it into trunk? If so, let's setup the cache ahead of time. But I think this benchmark is mainly for comparing the trunk with my branch, which means that we probably won't merge this `testUpdateCache` into master, which also means the same procedure constructing some memory records are acceptable since we are taking the time cost difference. ---------------------------------------------------------------- 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