RFR: 8283063: Optimize Observable{List/Set/Map}Wrapper.retainAll/removeAll [v5]
Michael Strauß
mstrauss at openjdk.org
Sun Apr 2 23:50:15 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 incrementally with one additional commit since the last revision:
addressed review comments
-------------
Changes:
- all: https://git.openjdk.org/jfx/pull/751/files
- new: https://git.openjdk.org/jfx/pull/751/files/6ea639b6..91260638
Webrevs:
- full: https://webrevs.openjdk.org/?repo=jfx&pr=751&range=04
- incr: https://webrevs.openjdk.org/?repo=jfx&pr=751&range=03-04
Stats: 66 lines in 5 files changed: 0 ins; 8 del; 58 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