Copilot commented on code in PR #21601:
URL: https://github.com/apache/echarts/pull/21601#discussion_r3176947767
##########
src/processor/dataSample.ts:
##########
@@ -72,6 +74,17 @@ const indexSampler = function (frame: ArrayLike<number>) {
return Math.round(frame.length / 2);
};
+function countDataInAxisExtent(data: SeriesData, baseAxis: Axis, baseDim:
string) {
+ let count = 0;
+ const scale = baseAxis.scale;
+ data.each(baseDim, function (value: number) {
+ if (scale.contain(value)) {
+ count++;
+ }
+ });
+ return count;
Review Comment:
`countDataInAxisExtent` does a full `SeriesData.each` traversal to compute
the visible-window count. This adds an extra O(n) pass on every reset/zoom even
in the common case where downsampling ends up being skipped (rate <= 1), and
can become a hot path for very large series during slider dragging. Consider
moving this to a store-level tight loop (avoiding per-item function binding) or
adding a lightweight `DataStore` helper that counts values within `[min, max]`
without cloning/allocating, similar to the optimized loop in
`DataStore.selectRange`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]