diff --git a/src/profile-logic/marker-timing.js b/src/profile-logic/marker-timing.js index 0f280838d7..8635198b75 100644 --- a/src/profile-logic/marker-timing.js +++ b/src/profile-logic/marker-timing.js @@ -10,6 +10,10 @@ import type { MarkerTimingAndBuckets, } from 'firefox-profiler/types'; +// Arbitrarily set an upper limit for adding marker depths, avoiding very long +// overlapping marker timings. +const MAX_STACKING_DEPTH = 300; + /** * This function computes the timing information for laying out the markers in the * MarkerChart component. Each marker is put into a single row based on its name. In @@ -163,6 +167,12 @@ export function getMarkerTiming( continue; } + if (markerTimingsForName.length >= MAX_STACKING_DEPTH) { + // There are too many markers stacked around the same time already, let's + // ignore this marker. + continue; + } + // Otherwise, let's add a new row! const newTiming = emptyTiming({ instantOnly: false }); addCurrentMarkerToMarkerTiming(newTiming);