Skip to content

Instantly share code, notes, and snippets.

@xk
Created December 18, 2010 12:31
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/746466 to your computer and use it in GitHub Desktop.
Save xk/746466 to your computer and use it in GitHub Desktop.
debugger.js
// 2010-12-16 jorge@jorgechamorro.com
// loopFreq.js displays event loop tick period in ms and KHz
// with debugger; slows down to a crawl !
var k_ms= 1e3;
setTimeout(function display () {
t= Date.now()-t;
console.log(["ctr: ",ctr, ", t:", t, "ms -> ", (ctr/t).toFixed(2), "KHz"].join(''));
setTimeout(display, k_ms);
ctr= 0;
t= Date.now()+ 2;
while (t > Date.now()) ; //get in sync with clock
}, k_ms);
var ctr= 0;
var t= Date.now()+ 2;
while (t > Date.now()) ; //get in sync with clock
(function foo () {
debugger; // this is the problem !
process.nextTick(foo);
ctr++;
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment