[prev in list] [next in list] [prev in thread] [next in thread] 

List:       openjdk-openjfx-dev
Subject:    Re: RFR: 8283063: Optimize Observable{List/Set/Map}Wrapper.retainAll/removeAll
From:       yosbits <duke () openjdk ! java ! net>
Date:       2022-03-19 0:15:31
Message-ID: 4PuRvMPNjgKClaiWjgS1uHXLMDvzuaznPss2iX0J5xo=.f4f5d807-17c8-4b4f-ac22-64fce9671422 () github ! com
[Download RAW message or body]

On Sat, 12 Mar 2022 04:57:37 GMT, Michael Strauß <mstrauss@openjdk.org> wrote:

> `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.

This is an equivalent change that partially includes the fix I proposed in #305.
It is good to apply it to Map / Set.

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

PR: https://git.openjdk.java.net/jfx/pull/751


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic