Skip to content

perf(datagrid): bound cache work to visible columns#1964

Draft
andiahmads wants to merge 1 commit into
TableProApp:mainfrom
andiahmads:fix/clickhouse-wide-grid-scrolling
Draft

perf(datagrid): bound cache work to visible columns#1964
andiahmads wants to merge 1 commit into
TableProApp:mainfrom
andiahmads:fix/clickhouse-wide-grid-scrolling

Conversation

@andiahmads

Copy link
Copy Markdown
Contributor

Summary

  • Prewarm only the data columns inside the current viewport.
  • Store formatted cells in a sparse per-row cache instead of allocating one slot per result column.
  • Track each cache entry's cost without rescanning every cached column after each cell update.
  • Add regression coverage for a 500-column result and a viewport around column 250.

Root cause

The display cache allocated space for every result column when the first cell in a row was formatted. Its synchronous and background prewarm paths also formatted every column in each row. A 1,000-row result with 500 columns could therefore schedule 500,000 formatting operations on the main actor, including cells far outside the viewport.

Cache cost updates also rescanned the dense row storage after each formatted cell. This made on-demand rendering scale with the total schema width instead of the number of visible cells.

Impact

Wide ClickHouse results now keep prewarm and cache work bounded to the visible columns. Horizontal scrolling fills newly visible columns on demand and then prewarms those columns after live scrolling ends.

Fixes #1219

Validation

  • swiftlint lint --strict
  • git diff --check
  • xcodebuild -project TablePro.xcodeproj -scheme TablePro -destination 'platform=macOS,arch=arm64' -skipPackagePluginValidation CODE_SIGNING_ALLOWED=NO test -only-testing:TableProTests/RowDisplayCacheTests -only-testing:TableProTests/TableViewCoordinatorDisplayCacheTests
  • Full TableProTests run: 8,631 passed and 77 unrelated tests failed in the local environment. The changed DataGrid and cache suites passed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

UI Lag While Scrolling Large Result Sets from ClickHouse

1 participant