borisssmidtCET commented on code in PR #14597: URL: https://github.com/apache/kafka/pull/14597#discussion_r1415317427
########## core/src/main/scala/kafka/security/authorizer/AclAuthorizer.scala: ########## @@ -61,18 +60,18 @@ object AclAuthorizer { val AllowEveryoneIfNoAclIsFoundProp = "allow.everyone.if.no.acl.found" case class VersionedAcls(acls: Set[AclEntry], zkVersion: Int) { + // iterating a set is slow, add an array view on the set. + lazy val aclsArray = acls.toArray Review Comment: this also had a significant speed up since iterating seq is slow. But the acls are only updated a few times while the iteration through them is done often. ########## core/src/main/scala/kafka/security/authorizer/AclAuthorizer.scala: ########## @@ -331,12 +330,15 @@ class AclAuthorizer extends Authorizer with Logging { } override def acls(filter: AclBindingFilter): lang.Iterable[AclBinding] = { - val aclBindings = new util.ArrayList[AclBinding]() - aclCache.forKeyValue { case (resource, versionedAcls) => - versionedAcls.acls.foreach { acl => - val binding = new AclBinding(resource, acl.ace) - if (filter.matches(binding)) - aclBindings.add(binding) + val aclBindings = new util.ArrayList[AclBinding](32) Review Comment: the preinitialization of the size is indeed questionable. -- 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. To unsubscribe, e-mail: jira-unsubscr...@kafka.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org