RFR: 8300487: Store cardinality as a field in BitSet [v6]

fabioromano1 duke at openjdk.org
Sat Jan 21 00:13:35 UTC 2023


> The 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 actually 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.

fabioromano1 has updated the pull request incrementally with one additional commit since the last revision:

  Moved changes in subclass NaturalsBitSet

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/11837/files
  - new: https://git.openjdk.org/jdk/pull/11837/files/7f860b79..0c3e7cdf

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=11837&range=05
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=11837&range=04-05

  Stats: 768 lines in 4 files changed: 618 ins; 103 del; 47 mod
  Patch: https://git.openjdk.org/jdk/pull/11837.diff
  Fetch: git fetch https://git.openjdk.org/jdk pull/11837/head:pull/11837

PR: https://git.openjdk.org/jdk/pull/11837


More information about the core-libs-dev mailing list