Skip to content

Instantly share code, notes, and snippets.

@xk
Last active December 10, 2016 12:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xk/b06fd049fc4b8b7000f9a7addfece2e0 to your computer and use it in GitHub Desktop.
Save xk/b06fd049fc4b8b7000f9a7addfece2e0 to your computer and use it in GitHub Desktop.
JavaScript execution wow and flutter
// 2016-11-29 jorge@jorgechamorro.com
// JavaScript execution wow and flutter
var MAX_ms= -1;
var r, now, ctr, str;
var MAX_ctr= -1;
var MIN_ctr= 10e9;
function sync (now,r) {
now= Date.now()+ 1;
while ( now > ( r= Date.now() ) ) ;
return r;
}
do {
ctr= 0, now= sync();
do ctr+= 1; while ( now === ( r= Date.now() ) );
r= r-now;
str= '';
if (r > MAX_ms) MAX_ms= r;
if (ctr < MIN_ctr) MIN_ctr= ctr;
if (ctr > MAX_ctr) MAX_ctr= ctr;
str= 'MAX_ms:'+ MAX_ms+ ' MIN_ctr:'+ MIN_ctr+ ' MAX_ctr:'+ MAX_ctr+ '\r';
process.stdout.write(str);
} while (1);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment