RFR: 6674: Optimize finding of first start time and first & last end times

Henrik Dafgård hdafgard at openjdk.java.net
Wed Jan 15 17:03:56 UTC 2020

On Tue, 14 Jan 2020 19:31:59 GMT, Marcus Hirt <hirt at openjdk.org> wrote:

>> This optimization relies on the fact that event lanes are sorted by timestamp. This allows us to skip performing very costly comparisons when finding the first start time or first/last end times of an IItemCollection and instead just get the first or last events in each lane and find the event in that set that was earliest or last, respectively.
>> This PR also removes the associated aggregators to strongly encourage downstream users to make use of the added RulesToolkit methods.
> Careful here. They are not sorted on start and end time both, and events are not guaranteed (except that we recommend that this is the case for the events of a particular event type, if at all possible) to be non-overlapping.

JMC parser currently guarantees that IItemCollection events are retrieved in sorted, disjoint, lanes. Each event is iterated over in the time that it was emitted, and if there is an overlap then it will be in another lane. This is why we iterate through the IItemCollection and then through the IItemIterable, even if the IItemCollection is filtered to only contain one type.

There is still the problem that this relies on the implicit assumption that these lanes are sorted in this fashion, but since we're currently performing a computationally intensive sorting during the parsing we should think about exploiting that fact.


PR: https://git.openjdk.java.net/jmc/pull/31

More information about the jmc-dev mailing list