Skip to content

perf(ui): use binary search for visible column window in VirtualResultGrid #524

Description

@ZhuchkaTriplesix

Problem

Currently, computeVisibleColumnWindow in lib/features/main_screen/result_grid_view.dart uses an O(C) linear search (while loop) to find the first and last visible columns based on scroll offset. For tables with a massive number of columns (e.g. 3,000+), this loop runs thousands of times per scroll frame (60Hz), causing UI jank.

Solution

Since columnOffsets is a strictly monotonically increasing array of prefix sums, we should replace the linear search with a Binary Search (O(log C)), which will reduce the iterations to roughly ~12 per frame even for huge tables.

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions