stats.js
JavaScript Performance Monitor
stats-js
此类提供了一个简单的信息框,可帮助您监视代码性能。
- FPS最后一秒渲染的帧。数字越大越好。
- MS渲染帧所需的毫秒数。数字越小越好。
- MB分配的内存的 MBytes。(运行 Chrome
--enable-precise-memory-info) - CUSTOM用户定义的面板支持。
截图
用法
var stats = new Stats();
stats.showPanel( 1 ); // 0: fps, 1: ms, 2: mb, 3+: custom
document.body.appendChild( stats.dom );
function animate() {
stats.begin();
// monitored code goes here
stats.end();
requestAnimationFrame( animate );
}
requestAnimationFrame( animate );