Skip to content

Instantly share code, notes, and snippets.

@junosuarez
Created February 5, 2016 07:00
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 junosuarez/eebc4d09225cfe19e8f6 to your computer and use it in GitHub Desktop.
Save junosuarez/eebc4d09225cfe19e8f6 to your computer and use it in GitHub Desktop.
let a = []; for(let i = 0; i < .5e6; i++) a.push(i);
let lag = 0
let last = Date.now()
let int = setInterval(_=>{let now = Date.now();let diff=now-last;lag = Math.max(lag, diff);last = now; console.log('x'.repeat(40), now, lag, diff)}, 500)
(function safe(arr, fn, i) { i = i || 0; setImmediate(_=> { fn(i++); if (i < arr.length - 1) safe(arr, fn, i)}) })(a, console.log)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment