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(pie): optimize performance of pie series #17275

Merged
merged 3 commits into from
Aug 4, 2022

Conversation

wind108369
Copy link
Contributor

@wind108369 wind108369 commented Jun 23, 2022

Brief Information

This pull request is in the type of:

  • bug fixing
  • new feature
  • others

What does this PR do?

饼图现在的渲染有性能问题,getPercentWithPrecision 是很消耗性能的方法,每一个数据项都需要执行一次,在 10000 个数据点的时候就能把页面卡死,可以总的执行一次再取数使用。

Fixed issues

Fixes #17173

Details

Before: What was the problem?

After: How does it behave after the fixing?

Document Info

One of the following should be checked.

  • This PR doesn't relate to document changes
  • The document should be updated later
  • The document changes have been made in apache/echarts-doc#xxx

Misc

ZRender Changes

  • This PR depends on ZRender changes (ecomfe/zrender#xxx).

Related test cases or examples to use the new APIs

N.A.

Others

Merging options

  • Please squash the commits into a single one when merging.

Other information

没有删掉getPercentWithPrecision,因为api里面有暴露给外包

测试之前需要执行 prepublish

@echarts-bot
Copy link

echarts-bot bot commented Jun 23, 2022

Thanks for your contribution!
The community will review it ASAP. In the meanwhile, please checkout the coding standard and Wiki about How to make a pull request.

Copy link
Contributor

@Ovilia Ovilia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please first add a test case by npm run mktest pie-percent to serve as benchmark to see how much improvement this PR makes.

@wind108369
Copy link
Contributor Author

1000个数据点,pie-percent.html中的数据,优化前
image

优化后
image

@wind108369 wind108369 requested a review from Ovilia June 24, 2022 07:38
@wind108369 wind108369 force-pushed the improve-pie-performance branch 2 times, most recently from 8487163 to 3d6ec90 Compare June 29, 2022 03:20
test/pie-percent.html Outdated Show resolved Hide resolved
@plainheart plainheart changed the title 优化饼图性能 perf(pie): optimize performance of pie series Jul 4, 2022
src/util/number.ts Outdated Show resolved Hide resolved
Copy link
Member

@plainheart plainheart left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. The optimization for the performance of the pie series looks quite significant!

src/chart/pie/PieSeries.ts Outdated Show resolved Hide resolved
src/util/number.ts Outdated Show resolved Hide resolved
src/chart/pie/PieSeries.ts Outdated Show resolved Hide resolved
src/util/number.ts Outdated Show resolved Hide resolved
src/util/number.ts Outdated Show resolved Hide resolved
Copy link
Member

@plainheart plainheart left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your contribution!

@plainheart plainheart requested review from Ovilia and removed request for Ovilia August 4, 2022 08:26
@Ovilia Ovilia merged commit c076a0c into apache:master Aug 4, 2022
@echarts-bot
Copy link

echarts-bot bot commented Aug 4, 2022

Congratulations! Your PR has been merged. Thanks for your contribution! 👍

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

Successfully merging this pull request may close these issues.

[Bug] Pie chart with large data has performance issue. 大数据量下饼图存在性能问题
4 participants