ui: stop creating timespans, timescales and pxspans on every slice
This CL fixes a major performance issue on ~largish (even at the scale
of ~70MB) traces where the UI becomes completely unusable when zoomed
in.
Change-Id: I16e56c28b2581674a94fa1e0b5c606f69ab2d036
diff --git a/ui/src/frontend/track_panel.ts b/ui/src/frontend/track_panel.ts
index 4c7b2a5..aab1e54 100644
--- a/ui/src/frontend/track_panel.ts
+++ b/ui/src/frontend/track_panel.ts
@@ -16,6 +16,7 @@
import m from 'mithril';
import {Actions} from '../common/actions';
+import {HighPrecisionTimeSpan} from '../common/high_precision_time';
import {TrackState} from '../common/state';
import {TPTime} from '../common/time';
@@ -26,6 +27,7 @@
import {BLANK_CHECKBOX, CHECKBOX, PIN} from './icons';
import {Panel, PanelSize} from './panel';
import {verticalScrollToTrack} from './scroll_helper';
+import {PxSpan, TimeScale} from './time_scale';
import {SliceRect, Track} from './track';
import {trackRegistry} from './track_registry';
import {
@@ -458,11 +460,14 @@
}
}
- getSliceRect(tStart: TPTime, tDur: TPTime, depth: number): SliceRect
- |undefined {
+ getSliceRect(
+ visibleTimeScale: TimeScale, visibleWindowTime: HighPrecisionTimeSpan,
+ windowSpan: PxSpan, tStart: TPTime, tDur: TPTime,
+ depth: number): SliceRect|undefined {
if (this.track === undefined) {
return undefined;
}
- return this.track.getSliceRect(tStart, tDur, depth);
+ return this.track.getSliceRect(
+ visibleTimeScale, visibleWindowTime, windowSpan, tStart, tDur, depth);
}
}