Skip to content

Commit 165ef3b

Browse files
authored
Bug fix: Do not pass all data points as parameters (#6528)
## Motivation for features / changes This was causing "Maximum call stack size" errors when we received too many data points. ## Technical description of changes I am simply looping over the data points and getting the min and max instead of passing them all to Math.min and Math.max ## Detailed steps to verify changes work correctly (as executed by you) I ran internally hardcoding the backend to return 300,000 data points. This caused the "Maximum call stack size" error. Then I made this change and the data loaded. I increased the number of data points to over 1 million(timeseries call was 7mb) and the data still loaded. When I went to 10 million data points the call failed after waiting 5 minutes.
1 parent 2a2439d commit 165ef3b

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

tensorboard/webapp/metrics/store/metrics_store_internal_utils.ts

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -389,12 +389,19 @@ export function generateNextCardStepIndex(
389389
export function generateScalarCardMinMaxStep(
390390
runsToSeries: RunToSeries<PluginType.SCALARS>
391391
): MinMaxStep {
392-
const allData = Object.values(runsToSeries)
392+
let minStep = Infinity;
393+
let maxStep = -Infinity;
394+
395+
Object.values(runsToSeries)
393396
.flat()
394-
.map((stepDatum) => stepDatum.step);
397+
.forEach((stepDatum) => {
398+
minStep = Math.min(minStep, stepDatum.step);
399+
maxStep = Math.max(maxStep, stepDatum.step);
400+
});
401+
395402
return {
396-
minStep: Math.min(...allData),
397-
maxStep: Math.max(...allData),
403+
minStep,
404+
maxStep,
398405
};
399406
}
400407

0 commit comments

Comments
 (0)