cats icon indicating copy to clipboard operation
cats copied to clipboard

Optimize `distinct`/`distinctBy` implementations for non-empty collections

Open satorg opened this issue 8 months ago • 1 comments

A follow up for #4608 (see my comment https://github.com/typelevel/cats/pull/4608#discussion_r1626935568). For an example of a pretty well optimized implementation one could check out the corresponding methods in Chain:

https://github.com/typelevel/cats/blob/930f25c544c787fe6703349090b5210a35249e70/core/src/main/scala/cats/data/Chain.scala#L797-L813 https://github.com/typelevel/cats/blob/930f25c544c787fe6703349090b5210a35249e70/core/src/main/scala/cats/data/Chain.scala#L826-L842

satorg avatar Jun 05 '24 17:06 satorg