RFR: 8283063: Optimize Observable{List/Set/Map}Wrapper.retainAll/removeAll [v3]
Michael Strauß
mstrauss at openjdk.org
Sat Apr 1 03:32:43 UTC 2023
> `Observable{List/Set/Map}Wrapper.retainAll/removeAll` can be optimized for some edge cases.
>
> 1. `removeAll(c)`:
> This is a no-op if 'c' is empty.
> For `ObservableListWrapper`, returning early skips an object allocation. For `ObservableSetWrapper` and `ObservableMapWrapper`, returning early prevents an enumeration of the entire collection.
>
> 2. `retainAll(c)`:
> This is a no-op if the backing collection is empty, or equivalent to `clear()` if `c` is empty.
>
> I've added some tests to verify the optimized behavior for each of the three classes.
Michael Strauß has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains five commits:
- Merge branch 'master' into fixes/JDK-8283063
# Conflicts:
# modules/javafx.base/src/main/java/com/sun/javafx/collections/ObservableListWrapper.java
# modules/javafx.base/src/main/java/com/sun/javafx/collections/ObservableMapWrapper.java
# modules/javafx.base/src/main/java/com/sun/javafx/collections/ObservableSequentialListWrapper.java
# modules/javafx.base/src/main/java/com/sun/javafx/collections/ObservableSetWrapper.java
- address review comments
- refactored removeAll/retainAll optimizations
- Optimize removeAll/retainAll for Observable{List/Set/Map}Wrapper
- Failing test
-------------
Changes: https://git.openjdk.org/jfx/pull/751/files
Webrev: https://webrevs.openjdk.org/?repo=jfx&pr=751&range=02
Stats: 822 lines in 11 files changed: 799 ins; 8 del; 15 mod
Patch: https://git.openjdk.org/jfx/pull/751.diff
Fetch: git fetch https://git.openjdk.org/jfx.git pull/751/head:pull/751
PR: https://git.openjdk.org/jfx/pull/751
More information about the openjfx-dev
mailing list