Using `setTimeout` to speed up `window.onload`

1 · Mathias Bynens · Sept. 8, 2010, 12:08 p.m.
A few days ago, Martín Borthiry contacted me with a question. He had been using the optimized asynchronous Google Analytics snippet for a while, and noticed an additional speed gain when wrapping it inside a setTimeout() with a delay of 0 milliseconds. His tests made it pretty clear that this technique was indeed slightly faster, but Martín had no clue why....