What problem does this feature solve?
In complex applications using frameworks like React, it is difficult to achieve optimal performance due to expensive cloning operations that have no way to opt out of. If the goal of these cloning operations (example) is to protect ECharts internals from mutations from users of the library, then it may be unnecessary as mutations are an anti-pattern in these contexts.
Having an optional (and initially experimental) property to tell ECharts to bypass cloning would put more responsibility on users to not abuse setOption calls, but could have a high upside for power users struggling with memory / growing JS heap size. It may also help with open memory leak issues: #7002 , #10130 , #19984 , #7125 , #18312 , #18686 , echarts-for-react/issues/533 (these may not actually be memory leaks but are a symptom of lingering performance issues).
What does the proposed API look like?
Introduce an optional immutableMode
property to setOption opts, aimed at optimizing performance for large datasets, where charts needs to re-render frequently. A very rough concept can be seen here: sjcobb#1
Open to feedback on other ideas, my branch is far from a working prototype, but I want to see if this idea has any traction before diving in further.
2条答案
按热度按时间vltsax251#
You can see below how heap snapshots steadily increase even after garbage collection kicks in, which eventually results in the browser tab crashing:
Line charts using 'time' axis are especially problematic or it's possible a variable in the Scheduler (maybe related to agentStubMap or an event handler?) needs to be cleaned up.
Edit: I found a related time axis bug ticket #19984
t2a7ltrp2#
This issue is also present in my project.