Depends on #25508
Comment From: pivotal-cla
@harshal-gav Please sign the Contributor License Agreement!
Click here to manually synchronize the status of this Pull Request.
See the FAQ for frequently asked questions.
Comment From: pivotal-cla
@harshal-gav Thank you for signing the Contributor License Agreement!
Comment From: sbrannen
Hi @harshal-gav,
Are you proposing this as an extended optimization if #25508 is merged?
Can you please provide further insight on the rationale for the proposed changes?
Comment From: harshal-gav
The proposed change of adding additional parameters to the tryAdvance method in the AggregatesSpliterator class can help avoid repetitive work by reducing the number of times the tryAdvance method needs to be called.
In the current implementation, when mergedAnnotation == null, the tryAdvance method is called with only the aggregate and action parameters. This means that if the tryAdvance method is not able to advance the spliterator, it will need to be called again with the same parameters. This can result in repetitive work, especially if the tryAdvance method is expensive or if the spliterator is advanced only one element at a time.
By adding additional parameters to the tryAdvance method, such as lowestDistance and annotationResult, the method can make use of previously computed values and avoid repetitive work. For example, if the lowestDistance and annotationResult values are computed during a previous call to the tryAdvance method, they can be reused in subsequent calls instead of recomputing them from scratch.
Overall, this change can help improve the performance of the AggregatesSpliterator class by reducing the number of times the tryAdvance method needs to be called, and by making better use of previously computed values.