echarts icon indicating copy to clipboard operation
echarts copied to clipboard

test: add performance optimization verification test

Open Srajan-Sanjay-Saxena opened this issue 1 month ago • 2 comments

Brief Information

This pull request is in the type of:

  • [x] bug fixing
  • [ ] new feature
  • [ ] others

What does this PR do?

Fixes canvas laggy rendering for geo maps with many labels by optimizing ZRender refresh cycles to prevent unnecessary re-renders.

Fixed issues

  • #21331: Canvas laggy rendering with geo maps containing many labels

Details

Before: What was the problem?

Geo maps with many data points and labels caused performance issues due to excessive refresh cycles in ZRender:

  • Multiple refresh() calls restarted animation loop unnecessarily (8 animation starts for 5 refresh calls)
  • Fixed 10-frame sleep threshold wasn't optimal for complex scenes
  • Redundant hover refresh requests wasted resources
  • Demo showing issue: https://www.makeapie.cn/echarts_content/xVNl_-jjok.html

After: How does it behave after the fixing?

Performance optimizations in ZRender prevent unnecessary re-renders:

  • ✅ Duplicate refresh prevention: 8 → 1 animation starts
  • ✅ Adaptive sleep threshold: Complex scenes sleep sooner (3-5 frames vs 10)
  • ✅ Hover refresh optimization: Prevents redundant flag setting
  • ✅ Automated test verification: test/test-optimizations.html

Document Info

One of the following should be checked.

  • [x] 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

Security Checking

  • [x] This PR uses security-sensitive Web APIs.

ZRender Changes

  • [x] This PR depends on ZRender changes (ecomfe/zrender#1142).

Related test cases or examples to use the new APIs

  • test/test-optimizations.html - Automated verification of all performance optimizations
  • Tests duplicate refresh prevention (8 → 1 animation starts)
  • Tests adaptive sleep threshold functionality
  • Tests hover refresh optimization
  • Provides automated verification of zrender performance improvements

Merging options

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

Other information

Performance improvements verified with automated tests showing significant reduction in unnecessary animation restarts and better resource management for complex visualizations.

Srajan-Sanjay-Saxena avatar Nov 03 '25 19:11 Srajan-Sanjay-Saxena

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.

This PR depends on ZRender changes. Please update the ZRender dependency to the latest nightly version including this change, which takes place everyday at 8:00 UTC (16:00 Beijing Time). You can use npm i zrender@npm:zrender-nightly@dev to update package.json. If you have any question about this, please leave a comment and we will give you extra help on this.

echarts-bot[bot] avatar Nov 03 '25 19:11 echarts-bot[bot]

i have upgraded the package of zrender to nightly in commit 5af7efd322e2ae17a574dce44e83e159b4512cd1

Srajan-Sanjay-Saxena avatar Nov 05 '25 18:11 Srajan-Sanjay-Saxena