I get 2.17 ms on Ubuntu Jaunty (9.0.4) with Firefox 3.5.2.
I get 2.37 ms on Ubuntu Jaunty (9.0.4) with Opera 10.
(function(){
var bufferLimit = 1000;
var buffer = [];
var moved = function(){
buffer[ buffer.length ] = new Date().getTime();
buffer.length > bufferLimit ? (function(){
//document.removeEventListener( 'mousemove', moved, false );
//console.log( buffer );
var diff = 0;
var len = buffer.length - 1;
for( var i = 0; i < len; i++ ){
diff += buffer[ i+1 ] - buffer[ i ];
}
var meanAvg = diff / len;
document.getElementsByTagName( 'body')[ 0 ].innerHTML += 'Captured "onmousemove": ' + bufferLimit + ' times. Average delay between events: ' + meanAvg + ' ms.
';
buffer.length = 0;
})() : 0 ;
}
document.addEventListener( 'mousemove', moved, false );
})();
No comments:
Post a Comment