SonicCloudOrg / sonic-client-web

🎉Front end of Sonic cloud real machine platform. Sonic云真机平台前端。

Home Page:https://sonic-cloud.cn

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Bug] echarts性能图表options构造存在性能问题

aoliaoaoaojiao opened this issue · comments

Search before asking

  • I searched in the issue and found nothing similar. | 我查找了并确认issue列表无相似报告。

Sonic version

一直存在

Deploy platform

Windows

Minimal reproduce step

打开性能监控,随时间页面越来越卡,类似如下的代码
data: props.procFps.map((obj) => { return moment(new Date(obj.timeStamp)).format('HH:mm:ss'); }),
每次有新的性能数据传输过来的时候,会新构建出一个array数组,随着时间越来越长,该map的长度也越来越大,最后构建出数组的速度也越来越慢,还会伴随着碎片内存的产生,也增加了GC的压力。不应该使用Map生成数组,而是应该有固定的数组初始化,每次接收数据push到数组中,然后直接将数组设置给echarts的对应options结构中。

Are you willing to submit a PR?

  • I'm willing to submit a PR! | 我将发起PR!