perf(grid): keep selection, focus and stats out of the ResultsTab rebuild (#885) - #974
Merged
Merged
Conversation
…uild (Closes #885) ResultsTab called setState from onRowSelected, onSelectionValuesChanged and onCellFocused, so every selection step rebuilt the whole tab (toolbar, status line, value panel and the grid) and recomputed aggregates synchronously. - Selected row, focused cell and selection stats live in ValueNotifiers; the staging toolbar, the value inspector panel and the calc bar listen through ValueListenableBuilders, so a step no longer rebuilds the tab or the grid. - Aggregates are recomputed after a 60 ms pause instead of on every step, and a sequence number drops results from superseded selections (an older isolate result could previously overwrite a newer one). Clearing the selection resets stats immediately. - Extend benchmark/grid_perf_bench.dart with a mouse-drag selection mode.
ZhuchkaTriplesix
deleted the
issue/885-grid-selection-stats-decoupled
branch
September 28, 2026 08:13
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Описание изменений
ResultsTabбольше не вызываетsetStateизonRowSelected,onSelectionValuesChangedиonCellFocused. Выбранная строка, фокусная ячейка и статистика выделения вынесены вValueNotifier, аDataGridStagingToolbar, панель значения (DataGridValuePanel) иDataGridCalcBarслушают их черезValueListenableBuilder. Шаг выделения перестраивает только эти виджеты, а не всю вкладку и сетку.kSelectionStatsDebounce), а не на каждом шаге стрелок или перетаскивания. Пустое выделение сбрасывает статистику сразу._statsSeqотбрасывает результаты устаревших расчётов: раньше медленный изолят для большого выделения мог перезаписать статистику более нового выделения.MODE=select(выделение перетаскиванием мыши черезResultsTab, вместе со статистикой).Замеры (profile, окно 2056×2616 px, 5000×120, выделение меняется почти каждый кадр)
Эффект умеренный (build p50 −23%, p90 −31%): остаток около 3 мс это перестройка самой сетки (строки в диапазоне выделения). Растр не менялся (около 4 мс).
Тесты
results_tab_test(3 новых): шаг выделения не пересоздаёт виджет сетки, то есть вкладка не перестраивается (тест падает на старом коде); статистика появляется только после паузы; сброс выделения и dispose с таймером не дают ошибок. Весь каталогtest/features/workspace(256 тестов) прогнал локально, все проходят.Не входит
_notifySelectionAndFocus(осталась на шаге выделения, счёт отложен).computeAdaptiveуже есть).Связанные Issue
Closes #885