RFR: 8302818: Optimize wrapper sets and immutable sets of Enums [v6]

Tingjun Yuan duke at openjdk.org
Wed Mar 22 01:17:43 UTC 2023


> Currently, the two subclasses of `java.util.EnumSet` optimize bulk operations when the argument is also a `EnumSet`, but there is no such optimization for wrapper sets (returned by `Collections.unmodifiableSet`, `Collections.synchronizedSet`, etc.) and immutable sets (returned by `Set.of` methods) of `Enum`s.
> 
> This PR introduces optimization classes for these situations.  No public APIs are changed.

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

  Delete compatible interfaces and introduce some methods
  
  I have deleted `{Regular,Jumbo}EnumSetCompatible` interfaces and introduced some package-private methods in `AbstractCollection`. This avoids rarely-used checks from static factories in `Collections` and does not reduce much performance compared against the previous implementation.

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/12498/files
  - new: https://git.openjdk.org/jdk/pull/12498/files/0e0b2bf1..c02ca488

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

  Stats: 392 lines in 9 files changed: 65 ins; 218 del; 109 mod
  Patch: https://git.openjdk.org/jdk/pull/12498.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/12498/head:pull/12498

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


More information about the core-libs-dev mailing list