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

- liangchenblue at gmail.com
Tue Mar 21 14:01:11 UTC 2023


Hello Stuart Marks, would you be able to take a look at this patch,
improving performance of enum-only immutable collections, as you are
the primary engineer in this area?


On Mon, Feb 20, 2023 at 9:40 PM Tingjun Yuan <duke at openjdk.org> wrote:
>
> > 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:
>
>   Set.copyOf: need defensive copy
>
> -------------
>
> Changes:
>   - all: https://git.openjdk.org/jdk/pull/12498/files
>   - new: https://git.openjdk.org/jdk/pull/12498/files/b9699bfe..0e0b2bf1
>
> Webrevs:
>  - full: https://webrevs.openjdk.org/?repo=jdk&pr=12498&range=04
>  - incr: https://webrevs.openjdk.org/?repo=jdk&pr=12498&range=03-04
>
>   Stats: 1 line in 1 file changed: 0 ins; 0 del; 1 mod
>   Patch: https://git.openjdk.org/jdk/pull/12498.diff
>   Fetch: git fetch https://git.openjdk.org/jdk pull/12498/head:pull/12498
>
> PR: https://git.openjdk.org/jdk/pull/12498


More information about the core-libs-dev mailing list