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] High CPU overload and user interaction freezed in SVG map (canvas & svg) #14875

Closed
plainheart opened this issue May 6, 2021 · 6 comments
Labels
en This issue is in English performance resolved SVG
Milestone

Comments

@plainheart
Copy link
Member

Version

5.1.1

Reproduction link

https://echarts.apache.org/examples/zh/editor.html?c=geo-svg-scatter-simple

Steps to reproduce

  • Open the reproduction link
  • Watch the CPU overload in default canvas renderer
  • Switch to svg renderer
  • Watch the CPU overload and effectScatter rendering
  • The effectScatter's animation becomes not smooth any more

What is expected?

Lower CPU overload and effectScatter has a smooth animation

What is actually happening?

High CPU overload and the animation of effectScatter is not smooth.

effectScatter with svg renderer

effectScatter with svg coord

Simple effectScatter

Others

I noticed that a strange zrender level named zr_100000 was added to the DOM.

@echarts-bot echarts-bot bot added bug en This issue is in English labels May 6, 2021
@plainheart plainheart added the pending We are not sure about whether this is a bug/new feature. label May 6, 2021
@pissang
Copy link
Contributor

pissang commented May 6, 2021

@plainheart

zr_100000 is a special zlevel that provided to the hover layer.

SVG rendering mode is not good at animation performance because each frame it needs to find out which DOM needs to be updated and manipulate the attributes of DOM(just like what virtual dom does). Even if we did lots of optimizations, it's still not as fast as Canvas. Especially in a case like this map which has lots of elements. The advance of SVG rendering mode is reducing the memory usage on mobile devices.

@plainheart
Copy link
Member Author

@pissang Thanks for the detailed explanation. So this should not be considered a bug.

@pissang
Copy link
Contributor

pissang commented May 6, 2021

After profiling this case, it seems getDefs method takes lots of time, which I didn't expect.

image

Perhaps it still has some chance to do more optimization

@pissang pissang added this to the 5.3.0 milestone May 6, 2021
@plainheart plainheart added the SVG label May 6, 2021
@pissang
Copy link
Contributor

pissang commented Oct 8, 2021

Seems the performances have been improved in the new SVG renderer ecomfe/zrender#836

@plainheart
Copy link
Member Author

Awesome! The performance got improved significantly. It can be closed later.

@plainheart plainheart removed bug pending We are not sure about whether this is a bug/new feature. waiting-for: community labels Oct 8, 2021
@pissang pissang closed this as completed Nov 16, 2021
@hao-kuai
Copy link

@plainheart

zr_100000 is a special zlevel that provided to the hover layer.

SVG rendering mode is not good at animation performance because each frame it needs to find out which DOM needs to be updated and manipulate the attributes of DOM(just like what virtual dom does). Even if we did lots of optimizations, it's still not as fast as Canvas. Especially in a case like this map which has lots of elements. The advance of SVG rendering mode is reducing the memory usage on mobile devices.

如何移除zr_100000图层?这会导致浏览器自带复制图片复制内容失败。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
en This issue is in English performance resolved SVG
Projects
None yet
Development

No branches or pull requests

3 participants