RFR: 8088923: IOOBE when adding duplicate categories to the BarChart [v3]
Markus Mack
mmack at openjdk.org
Fri Jun 21 22:10:42 UTC 2024
On Fri, 21 Jun 2024 15:22:41 GMT, Markus Mack <mmack at openjdk.org> wrote:
>> This PR provides the test case given in the JBS issue, and a simple fix for the index calculation when inserting data after previous data with duplicate categories.
>>
>> Also, I've added a comment to `BarChart`s javadoc, clarifying the behavior that was apparently assumed (but broken) previously.
>>
>> The index lookup is skipped for performance reasons if there are no duplicates, corresponding to the previous implementation.
>> Further optimizations would be possible, but probably are not really helpful without more extensive changes. The previous code already loops over all categories to check if they are present, typically nested in a loop adding many data items, thus already scaling quadratically when adding lots of mostly unique data points.
>
> Markus Mack has updated the pull request incrementally with one additional commit since the last revision:
>
> additional BarChart tests & updated fix: Insert new categories according to the concatenation of the data of all series, skipping duplicates
The last implementation could have caused a regression if anyone relied on the previous ordering when there are no duplicates and an insertion is made within a series.
I've updated the algorithm and added unit tests to ensure this should now be consistent with the previous behavior, and also works when there are duplicates. @andy-goryachev-oracle @mstr2 Please re-review.
-------------
PR Comment: https://git.openjdk.org/jfx/pull/1476#issuecomment-2183523702
More information about the openjfx-dev
mailing list