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

fabioromano1 duke at openjdk.org
Wed Jan 18 12:38:34 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.
> 
> Moreover, it has been implemented a new method for testing wheter a bit set includes another bit set (i.e., the set of true bits of the parameter is a subset of the true bits of the instance).

fabioromano1 has updated the pull request incrementally with five additional commits since the last revision:

 - Revert "Formatted"
   
   This reverts commit dc2ee2c45a522f86cf8b9ab02c059e13ad5cabe7.
 - Revert "Format file"
   
   This reverts commit 39300ee7491e735bd890cb7b08be465efccbb4a1.
 - Revert "Format file"
   
   This reverts commit b4ac41f53a008e4326bc93761cc397f48f660a19.
 - Revert "Removed trailing spaces"
   
   This reverts commit 57940e7f931b373b0121bf86f860df47829f6324.
 - Revert "Added author to includes(BitSet)"
   
   This reverts commit d06ed69de02201cef908a7c16528690348f15583.

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/11837/files
  - new: https://git.openjdk.org/jdk/pull/11837/files/206e967d..7af49d6c

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

  Stats: 425 lines in 1 file changed: 39 ins; 48 del; 338 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