RFR: 8264770: BidirectionalBinding should use InvalidationListener to prevent boxing
Kevin Rushforth
kcr at openjdk.java.net
Tue Apr 6 13:40:30 UTC 2021
On Mon, 5 Apr 2021 23:38:29 GMT, Kevin Rushforth <kcr at openjdk.org> wrote:
>> Seems like I forgot to hit the send button on the webform. Here's the tracking number: 9069787.
>>
>> I've used the following manual benchmark, which bidirectionally binds two properties and then produces a billion change notifications.
>> DoubleProperty property1 = new SimpleDoubleProperty();
>> DoubleProperty property2 = new SimpleDoubleProperty();
>> property2.bindBidirectional(property1);
>>
>> long start = System.nanoTime();
>>
>> for (int i = 0; i < 1000000000; ++i) {
>> property1.set((i % 2 == 0) ? 12345.0 : 54321.0);
>> }
>>
>> long end = System.nanoTime();
>>
>> System.out.println("Time elapsed (ms): " + (end - start) / 1000000);
>>
>> And these are the results I got (time elapsed, in milliseconds):
>>
>> | | before | after |
>> | ------------|--------|-------|
>> | Test run 1: | 28608 | 9122 |
>> | Test run 2: | 27928 | 9065 |
>> | Test run 3: | 31140 | 9181 |
>> | Test run 4: | 28041 | 9127 |
>> | Test run 5: | 28730 | 9181 |
>>
>> So in this synthetic benchmark, the new implementation has a 3x performance improvement compared to the old implementation.
>
>> Seems like I forgot to hit the send button on the webform. Here's the tracking number: 9069787.
>
> I see it now. And thanks for providing the benchmark. That's what I was looking for.
The bug is now visible here: https://bugs.openjdk.java.net/browse/JDK-8264770
-------------
PR: https://git.openjdk.java.net/jfx/pull/454
More information about the openjfx-dev
mailing list