On Tue, 24 Mar 2026 18:30:20 GMT, chuckyschluz <[email protected]> wrote:

>> I thought so too. But wouldn't we save some `BitSet` creations then?
>
> `distinct()` uses a temporary HashSet to track the entries, which conveys all 
> the overhead of the collection, hashing, and so on. 
> 
> I could test it later tonight, but I am virtually certain `distinct` will 
> slow things down (not to mention additional memory usage and garbage 
> collection).

> But wouldn't we save some `BitSet` creations then?

`BitSet` is much, much better for this.  It's compact, and fast, and some 
operations (like distinct and sort) are effectively free.  Even for selections 
that span 1,000,000 items it needs something like 122 kB.

-------------

PR Review Comment: https://git.openjdk.org/jfx/pull/2100#discussion_r2983608374

Reply via email to