New subclass of BitSet "NaturalsBitSet" to store cardinality in a field
Fabio Romano
fabio19298 at gmail.com
Sun Jan 22 13:20:46 UTC 2023
This enanchment is useful for applications that make heavy use of BitSet
objects as sets of integers, and therefore they need to make a lot of calls
to cardinality() method, which in BitSet class require linear time in the
number of words in use by the bit set.
This optimization reduces the cost of calling cardinality() to constant
time, as it simply returns the value of the field, and it also try to make
as little effort as possible to update the field, when needed.
Link to the Pull Request: https://github.com/openjdk/jdk/pull/12133
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/core-libs-dev/attachments/20230122/3a096662/attachment.htm>
More information about the core-libs-dev
mailing list