borisssmidtCET commented on code in PR #14597: URL: https://github.com/apache/kafka/pull/14597#discussion_r1415341068
########## 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 def exists: Boolean = zkVersion != ZkVersion.UnknownVersion } - class AclSeqs(seqs: Seq[AclEntry]*) { - def find(p: AclEntry => Boolean): Option[AclEntry] = { - // Lazily iterate through the inner `Seq` elements and stop as soon as we find a match - val it = seqs.iterator.flatMap(_.find(p)) - if (it.hasNext) Some(it.next()) - else None - } - def isEmpty: Boolean = !seqs.exists(_.nonEmpty) + class AclSeqs(val acls: Array[AclEntry]) { Review Comment: having a single array avoids creating a boxed boolean for the isEmpty function. -- 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