You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
perf(grid): eliminate eager List<String> allocation on every pointer-move during drag selection #1348
In lib/features/workspace/grid/grid_pointer_selection.dart (lines 12–25, 142–154), during mouse-drag selection (_isDragSelecting), whenever the pointer moves and crosses a cell coordinate boundary: _notifySelectionAndFocus() extracts all cell values in the selection bounding box:
final values =<String>[];
for (var r = minRow; r <= maxRow; r++) {
final row = _sortedRows[r];
for (var c = minCol; c <= maxCol; c++) {
values.add(row[c].toString());
}
}
widget.onSelectionChanged?.call(_selection, values);
For a 100-row × 10-column selection box, this allocates and populates a new 1,000-element List<String> on every pointer-move event (up to 60–120 times per second during dragging).
Meanwhile, ResultsTab already debounces selection calculations by 60 ms (_calcDebounceTimer). The intermediate lists allocated during active dragging are discarded immediately, causing unnecessary GC pressure and transient frame drops during gestures.
Proposed Solution
Separate coordinate selection updates from value extraction:
Provide lightweight coordinate bounds in onSelectionChanged without eagerly extracting strings.
Defer string extraction until drag ends (pointer-up) or until the debounced calculation timer fires.
Only query the selected cell string values when actually calculating stats or copying to clipboard.
Acceptance Criteria
Dragging selection across large cell ranges does not allocate intermediate List<String> objects on every pointer-move event.
Selection highlighting and live coordinate bounds update smoothly at 60/120 Hz.
Selection calc metrics in ResultsTab remain accurate and properly updated.
Activity
ZhuchkaTriplesix commentedon Oct 11, 2026
Done in #1414 (merged into
dev).