Skip to content

Commit f02e7ca

Browse files
authored
ui: Fix disappearing slices by removing an optimization that assumes sorted slices in BaseSliceTrack (#3044)
Currently we make the assumption in BaseSliceTrack that slices are ordered by `ts`, which allows us to perform a very specific optimization which avoids rendering anything when the first slice is off the right hand side of the viewport. However, slices from the mipmap function are ordered by depth first then ts, meaning that slices are not necessarily sorted by ts. In practice, slices at lower depths usually do start before those at higher depths anyway, so this is usually not an issue. This patch removes the optimization entirely as it seems pretty dubious whether it actually helps all that much. Fixes: https://buganizer.corp.google.com/issues/446503267
1 parent 56744c9 commit f02e7ca

File tree

1 file changed

+0
-10
lines changed

1 file changed

+0
-10
lines changed

ui/src/components/tracks/base_slice_track.ts

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ import {assertExists} from '../../base/logging';
2121
import {clamp, floatEqual} from '../../base/math_utils';
2222
import {cropText} from '../../base/string_utils';
2323
import {Time, time} from '../../base/time';
24-
import {exists} from '../../base/utils';
2524
import {uuidv4Sql} from '../../base/uuid';
2625
import {featureFlags} from '../../core/feature_flags';
2726
import {raf} from '../../core/raf_scheduler';
@@ -110,15 +109,6 @@ function filterVisibleSlices<S extends Slice>(
110109
// by timestamp you can binary search for the last slice such
111110
// that slice.start <= end.
112111

113-
// One specific edge case that will come up often is when:
114-
// For all slice in slices: slice.startNsQ > end (e.g. all slices are
115-
// to the right).
116-
// Since the slices are sorted by startS we can check this easily:
117-
const maybeFirstSlice: S | undefined = slices[0];
118-
if (exists(maybeFirstSlice) && maybeFirstSlice.startNs > end) {
119-
return [];
120-
}
121-
122112
return slices.filter((slice) => slice.startNs <= end && slice.endNs >= start);
123113
}
124114

0 commit comments

Comments
 (0)