You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "Kamalesh Palanisamy (Jira)" <ji...@apache.org> on 2023/01/12 15:51:00 UTC

[jira] [Commented] (KAFKA-14615) Use sizeCompare(Iterable[_]) to compare two iterables

    [ https://issues.apache.org/jira/browse/KAFKA-14615?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17676239#comment-17676239 ] 

Kamalesh Palanisamy commented on KAFKA-14615:
---------------------------------------------

[~divijvaidya] I am looking into this issue now. I am new to the project, so it will take some time for me to open the PR. I hope that's fine! 

> Use sizeCompare(Iterable[_]) to compare two iterables
> -----------------------------------------------------
>
>                 Key: KAFKA-14615
>                 URL: https://issues.apache.org/jira/browse/KAFKA-14615
>             Project: Kafka
>          Issue Type: Improvement
>            Reporter: Divij Vaidya
>            Assignee: Kamalesh Palanisamy
>            Priority: Minor
>              Labels: Newbie, newbie
>             Fix For: 4.0.0
>
>
> Since Scala 2.12 is being deprecated in 4.x version, we can utilize some improved methods for comparing size of scala collections which were introduced starting 2.13.
> This task is to find and replace usage of code paths where we use (IterableA.size == IterableB.size) having a complexity of O(IterableA size + IterableB size) with sizeCompare() method which has a complexity of O(min(IterableA size, IterableB size))
> Some examples where sizeCompare() could be used are:
> 1. [https://github.com/apache/kafka/blob/78d4458b94e585bc602a4ae307d3de54fcedf2af/core/src/main/scala/kafka/server/KafkaApis.scala#L1177]
> 2. [https://github.com/apache/kafka/blob/78d4458b94e585bc602a4ae307d3de54fcedf2af/core/src/main/scala/kafka/tools/JmxTool.scala#L215] 
> 3. 
>  [1] [https://github.com/scala/scala/pull/6758]
>  [2] [https://github.com/scala/scala/pull/6950] 



--
This message was sent by Atlassian Jira
(v8.20.10#820010)