Thursday, March 14, 2013

JavaScript Performance Montior


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.

Screenshots

stats_js_fps.pngstats_js_ms.png

Usage

var stats = new Stats();
stats.setMode(1); // 0: fps, 1: ms

// Align top-left
stats.domElement.style.position = 'absolute';
stats.domElement.style.left = '0px';
stats.domElement.style.top = '0px';

document.body.appendChild( stats.domElement );

setInterval( function () {

    stats.begin();

    // your code goes here

    stats.end();

}, 1000 / 60 );

Reference

https://github.com/mrdoob/stats.js

Sponsor Ads


No comments:

Post a Comment