RFR: 8252936: Optimize removal of listeners from ExpressionHelper.Generic
yosbits
github.com+7517141+yososs at openjdk.java.net
Thu Sep 10 09:50:35 UTC 2020
On Wed, 9 Sep 2020 06:53:11 GMT, dannygonzalez <github.com+6702882+dannygonzalez at openjdk.org> wrote:
>> @dannygonzalez Per [this message](https://mail.openjdk.java.net/pipermail/openjfx-dev/2020-September/027534.html) on
>> the openjfx-dev mailing list, I have filed a new JBS issue for this PR to use. Please change the title to:
>> 8252936: Optimize removal of listeners from ExpressionHelper.Generic
>
> Thanks @kevinrushforth, I've changed the title.
I have found that fixing this rudimentary problematic code alleviates your problem.
**This fix improves CPU utilization by 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;
}
-------------
PR: https://git.openjdk.java.net/jfx/pull/108
More information about the openjfx-dev
mailing list