mrdoob /stats.js

JavaScript Performance Monitor

★ 9,162⑂ 1,183👁 177⑃ 70● 0▤ 16
JavaScriptMITCreated 2010-04-08mrdoob.github.io/stats.js/
More from this author
Download: r17r17 ↓172016-10-29
+0
Daily
9,162
stars
1,183
forks
177
watchers
70
prs
0
issues
16
releases

README

stats.js
========

 JavaScript Performance Monitor 

This class provides a simple info box that will help you monitor your code performance.

 FPS Frames rendered in the last second. The higher the number the better.
 MS Milliseconds needed to render a frame. The lower the number the better.
 MB MBytes of allocated memory. (Run Chrome with --enable-precise-memory-info)
 CUSTOM User-defined panel support.


 Screenshots 

!fps.png
!ms.png
!mb.png
!custom.png


 Installation 
bash
npm install stats.js


 Usage 

javascript
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 );



 Bookmarklet 

You can add this code to any page using the following bookmarklet:

javascript
javascript:(function(){var script=document.createElement('script');script.onload=function(){var stats=new Stats();document.body.appendChild(stats.dom);requestAnimationFrame(function loop(){stats.update();requestAnimationFrame(loop)});};script.src='https://mrdoob.github.io/stats.js/build/stats.min.js';document.head.appendChild(script);})()

Latest release

r17 r17 2016-10-29
(1,965 KB, gzip: 1,053 KB)
- Converted to module. 72 (@terkelg)

Snapshot: 2026-11-16T09:23:14Z · Data license Apache-2.0 · JSON