Skip to content

perf(datagrid): serve row count from cache to smooth scrolling#1726

Open
desperadoxhy wants to merge 1 commit into
TableProApp:mainfrom
desperadoxhy:perf/datagrid-rowcount-cache
Open

perf(datagrid): serve row count from cache to smooth scrolling#1726
desperadoxhy wants to merge 1 commit into
TableProApp:mainfrom
desperadoxhy:perf/datagrid-rowcount-cache

Conversation

@desperadoxhy

Copy link
Copy Markdown
Contributor

问题

NSTableView 在布局、滚动时多次调 numberOfRows,每次都重新构造行集合(tableRowsProvider(),struct 拷贝 + refcount churn)。滚大表时开销累积。

方案

numberOfRows 改用已维护的 cachedRowCount。逐一核对了 6 条行数变更路径(初始加载、增删行、全量替换、撤销重做),确认每条都在 reloadData/insertRows/removeRows 之前调用了 updateCache()cachedRowCount 无滞后窗口。

验证

  • BUILD SUCCEEDED
  • TableViewCoordinatorRowCountCacheTests 覆盖 cachedRowCount 与实际行数在加载、追加、删除、全量替换下的一致性

@github-actions

Copy link
Copy Markdown
Contributor

Thank you for your contribution! Before we can merge this PR, you need to sign our Contributor License Agreement.

To sign, please comment below with:

I have read the CLA Document and I hereby sign the CLA.


I have read the CLA Document and I hereby sign the CLA.


xuhengyu seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot.

@desperadoxhy

Copy link
Copy Markdown
Contributor Author

I have read the CLA Document and I hereby sign the CLA.

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