js在浏览器中怎么会越变越变慢,我写了一个js的客户端程序。在浏览器中运行了一段时间后,就会变得慢。
我每次都会打印出他的运行时间:数据如下。
开始:
rebuildSnapshot repaint :121ms
rebuildSnapshot repaint :141ms
rebuildSnapshot repaint :140ms
rebuildSnapshot repaint :141ms
rebuildSnapshot repaint :141ms
rebuildSnapshot repaint :140ms
rebuildSnapshot repaint :140ms
rebuildSnapshot repaint :141ms
rebuildSnapshot repaint :141ms
rebuildSnapshot repaint :125ms
十分钟后:
rebuildSnapshot repaint :194ms
rebuildSnapshot repaint :201ms
rebuildSnapshot repaint :196ms
rebuildSnapshot repaint :203ms
rebuildSnapshot repaint :203ms
rebuildSnapshot repaint :203ms
rebuildSnapshot repaint :203ms
rebuildSnapshot repaint :196ms
一个小时后:
rebuildSnapshot repaint :235ms
rebuildSnapshot repaint :234ms
rebuildSnapshot repaint :235ms
rebuildSnapshot repaint :234ms
rebuildSnapshot repaint :234ms
rebuildSnapshot repaint :235ms
rebuildSnapshot repaint :250ms
数小时后:
rebuildSnapshot repaint :250ms
rebuildSnapshot repaint :297ms
rebuildSnapshot repaint :297ms
rebuildSnapshot repaint :312ms
rebuildSnapshot repaint :312ms
rebuildSnapshot repaint :312ms
rebuildSnapshot repaint :313ms
以后差不多也就如此了。
而且每次如果刷新一就会变慢一些(按F5键),如果连续刷新7、8此次的话就会直接像一小时后的状态一样慢。
我每次都会打印出他的运行时间:数据如下。
开始:
rebuildSnapshot repaint :121ms
rebuildSnapshot repaint :141ms
rebuildSnapshot repaint :140ms
rebuildSnapshot repaint :141ms
rebuildSnapshot repaint :141ms
rebuildSnapshot repaint :140ms
rebuildSnapshot repaint :140ms
rebuildSnapshot repaint :141ms
rebuildSnapshot repaint :141ms
rebuildSnapshot repaint :125ms
十分钟后:
rebuildSnapshot repaint :194ms
rebuildSnapshot repaint :201ms
rebuildSnapshot repaint :196ms
rebuildSnapshot repaint :203ms
rebuildSnapshot repaint :203ms
rebuildSnapshot repaint :203ms
rebuildSnapshot repaint :203ms
rebuildSnapshot repaint :196ms
一个小时后:
rebuildSnapshot repaint :235ms
rebuildSnapshot repaint :234ms
rebuildSnapshot repaint :235ms
rebuildSnapshot repaint :234ms
rebuildSnapshot repaint :234ms
rebuildSnapshot repaint :235ms
rebuildSnapshot repaint :250ms
数小时后:
rebuildSnapshot repaint :250ms
rebuildSnapshot repaint :297ms
rebuildSnapshot repaint :297ms
rebuildSnapshot repaint :312ms
rebuildSnapshot repaint :312ms
rebuildSnapshot repaint :312ms
rebuildSnapshot repaint :313ms
以后差不多也就如此了。
而且每次如果刷新一就会变慢一些(按F5键),如果连续刷新7、8此次的话就会直接像一小时后的状态一样慢。