RFR: 8273138: BidirectionalBinding fails to observe changes of invalid properties
Michael Strauß
mstrauss at openjdk.java.net
Mon Aug 30 13:33:44 UTC 2021
This PR fixes a bug that was introduced in #454.
Since this fix might impact the performance considerations in the original PR, I ran a performance benchmark against the previous `ChangeListener`-based implementation, which still shows better performance for the new implementation:
@State(Scope.Benchmark)
public class BindingBenchmark {
DoubleProperty property1 = new SimpleDoubleProperty();
DoubleProperty property2 = new SimpleDoubleProperty();
public BindingBenchmark() {
property2.bindBidirectional(property1);
}
@Benchmark
public void benchmark() {
for (int i = 0; i < 10000000; ++i) {
property1.set((i % 2 == 0) ? 12345.0 : 54321.0);
}
}
}
| Benchmark | Mode | Cnt | Score | Error | Units |
|-----------|------|-----|-------|-------|--------|
| ChangeListener | thrpt | 5 | 7.463 | 0.040 | ops/s |
| InvalidationListener (fixed) | thrpt | 5 | 15.095 | 0.092 | ops/s |
-------------
Commit messages:
- fixed invalidation bug
- added failing test
Changes: https://git.openjdk.java.net/jfx/pull/614/files
Webrev: https://webrevs.openjdk.java.net/?repo=jfx&pr=614&range=00
Issue: https://bugs.openjdk.java.net/browse/JDK-8273138
Stats: 54 lines in 2 files changed: 54 ins; 0 del; 0 mod
Patch: https://git.openjdk.java.net/jfx/pull/614.diff
Fetch: git fetch https://git.openjdk.java.net/jfx pull/614/head:pull/614
PR: https://git.openjdk.java.net/jfx/pull/614
More information about the openjfx-dev
mailing list