RFR: 8252936: Optimize removal of listeners from ExpressionHelper.Generic
yosbits
github.com+7517141+yososs at openjdk.java.net
Thu Sep 10 15:53:46 UTC 2020
On Thu, 10 Sep 2020 13:41:00 GMT, Kevin Rushforth <kcr at openjdk.org> wrote:
>> I have found that fixing this rudimentary problematic code alleviates your problem.
>>
>> **This fix will reduce CPU usage by about 1/3 without your changes.**
>> **This fix improves performance in many widespread use cases.**
>>
>> However, I'm wondering how to report the problem. Should it be handled in this issue? Should I deal with a new issue
>> for a rudimentary issue?
>> @kevinrushforth What should i do?
>>
>> https://github.com/openjdk/jfx/blob/22d4343fe8563c2931910b98e8f18c6fd4a48f05/modules/javafx.base/src/main/java/com/sun/javafx/collections/ObservableListWrapper.java#L170-L206
>>
>> Rewritten so that BitSet is not used.
>> Java
>> @Override
>> public boolean removeAll(Collection<?> c) {
>> if(this.isEmpty() || c.isEmpty()){
>> return false;
>> }
>> beginChange();
>> boolean removed = false;
>> for (int i = size()-1; i>=0; i--) {
>> if (c.contains(get(i))) {
>> remove(i);
>> removed = true;
>> }
>> }
>> endChange();
>> return removed;
>> }
>>
>> @Override
>> public boolean retainAll(Collection<?> c) {
>> if(this.isEmpty() || c.isEmpty()){
>> return false;
>> }
>> beginChange();
>> boolean retained = false;
>> for (int i = size()-1; i>=0; i--) {
>> if (!c.contains(get(i))) {
>> remove(i);
>> retained = true;
>> }
>> }
>> endChange();
>> return retained;
>> }
>
> @yososs Please file a new JBS issue for this. You will need to prove that your proposed change is functionally
> equivalent (or that any perceived changes are incidental and still conform to the spec). You should also think about
> whether your proposed change needs additional tests.
Because it is such a small correction
Problem from me I feel that it is not easy to register, but I will try to register.
It has passed two existing tests for compatibility:
* gradle base:test
* gradle controls:test
-------------
PR: https://git.openjdk.java.net/jfx/pull/108
More information about the openjfx-dev
mailing list