Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perf: 优化开启多行文本时的布局性能 #2734

Merged
merged 7 commits into from
May 24, 2024
Merged

Conversation

lijinke666
Copy link
Member

@lijinke666 lijinke666 commented May 20, 2024

👀 PR includes

🎨 Enhance

  • Code style optimization
  • Refactoring
  • Change the UI
  • Improve the performance
  • Type optimization

📝 Description

#2728 中优化了没有开启多行文本时的性能, 这个 PR 优化开启多行文本时的布局性能 (完成 #2728 (comment) 中的 TODO)

  1. 使用同一个 class 的示例, 动态更新 meta 的方式, 避免频繁创建实例 GC 的性能问题.
  2. 对文本长度相同, 并且单元格宽度一致的情况, 增加缓存, 大幅降低多行文本高度测量的性能损耗.
  3. 减少明细表频繁 setOptions 触发 merge 的性能损耗.
  4. 明细表适配 shallowRender 逻辑, 减少 initCell 的性能损耗.

测试数据样本 (2w 条明细数据):

image

🖼️ Screenshot

Before After
透视表 (9.8s -> 1.8s) image image
明细表 (16s -> 0.35s (有缓存) -> 5.7s (无缓存)) image image image

🔗 Related issue link

🔍 Self-Check before the merge

  • Add or update relevant docs.
  • Add or update relevant demos.
  • Add or update test case.
  • Add or update relevant TypeScript definitions.

Copy link

vercel bot commented May 20, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
antvis-s2 ❌ Failed (Inspect) May 24, 2024 7:41am

@github-actions github-actions bot added the next 2.0-next 版本的问题 label May 20, 2024
@lijinke666 lijinke666 changed the title perf: 优化开启多行文本时的布局性能 [WIP] perf: 优化开启多行文本时的布局性能 May 20, 2024
Copy link
Contributor

github-actions bot commented May 20, 2024

你好, @lijinke666 CI 执行失败, 请点击 [Details] 按钮查看, 并根据日志修复。

Hello, @lijinke666 CI run failed, please click the [Details] button for detailed log information and fix it.

@github-actions github-actions bot added 🚨 lint failed 静态检查失败 🚨 test failed 单元测试挂了 labels May 20, 2024
@lijinke666 lijinke666 changed the title [WIP] perf: 优化开启多行文本时的布局性能 perf: 优化开启多行文本时的布局性能 May 22, 2024
@github-actions github-actions bot removed the 🚨 lint failed 静态检查失败 label May 22, 2024
Copy link
Contributor

github-actions bot commented May 22, 2024

Size Change: +3.58 kB (+1.12%)

Total Size: 324 kB

Filename Size Change
./packages/s2-core/dist/index.min.js 227 kB +3.58 kB (+1.6%)
ℹ️ View Unchanged
Filename Size
./packages/s2-core/dist/style.min.css 402 B
./packages/s2-react/dist/index.min.js 69.4 kB
./packages/s2-react/dist/style.min.css 3.92 kB
./packages/s2-vue/dist/index.min.js 21 kB
./packages/s2-vue/dist/style.min.css 1.99 kB

compressed-size-action

@lijinke666 lijinke666 merged commit 388157c into next May 24, 2024
7 of 9 checks passed
@lijinke666 lijinke666 deleted the perf-multi-layout-2 branch May 24, 2024 08:20
@github-actions github-actions bot removed the 🚨 test failed 单元测试挂了 label May 24, 2024
@lijinke666
Copy link
Member Author

🎉 This PR is included in version @antv/s2-v2.0.0-next.22 🎉

The release is available on:

Your semantic-release bot 📦🚀

@lijinke666
Copy link
Member Author

🎉 This PR is included in version @antv/s2-react-v2.0.0-next.21 🎉

The release is available on:

Your semantic-release bot 📦🚀

@lijinke666
Copy link
Member Author

🎉 This PR is included in version @antv/s2-vue-v2.0.0-next.14 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
next 2.0-next 版本的问题 released on @next
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants