Skip to content

perf: optimize DataGridView scroll performance#522

Merged
datlechin merged 2 commits intomainfrom
perf/datagrid-scroll-optimization
Mar 31, 2026
Merged

perf: optimize DataGridView scroll performance#522
datlechin merged 2 commits intomainfrom
perf/datagrid-scroll-optimization

Conversation

@datlechin
Copy link
Copy Markdown
Collaborator

Summary

  • Pre-compute per-column metadata (enum/set, foreign key) once when data changes instead of per-cell during scroll — eliminates ~600 dictionary lookups per scroll frame, replaced with O(1) Set.contains()
  • Pre-warm display cache for the initial viewport on first data load — prevents formatting stalls (date parsing, line break sanitization) during first scroll
  • Skip redundant cell property resets (lineBreakMode, maximumNumberOfLines, etc.) on reused cells when they haven't been modified by editing

Addresses #519

Test plan

  • Open a table with 500+ rows, scroll rapidly — verify no lag or dropped frames
  • Verify enum/set columns still show dropdown indicators correctly
  • Verify foreign key arrow buttons still appear on FK columns
  • Edit a cell, then scroll — verify reused cells still display correctly (single-line truncation)
  • Switch between tabs and scroll — verify display cache works correctly

@datlechin datlechin merged commit 6811e50 into main Mar 31, 2026
2 checks passed
@datlechin datlechin deleted the perf/datagrid-scroll-optimization branch March 31, 2026 04:17
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.

1 participant