timeout = timeout < 10 ? 10 : timeout;

written by Tobie on February 28th, 2007 @ 01:35 AM

Read today on WebKit’s Surfin’ Safari blog (emphasis mine):

Some Web pages specify repeating timers with an extremely small timeout. In fact they often use the value 0 to mean “Fire as soon as you can.” Safari 2 does not throttle these timeouts, and so a poorly-constructed page that specifies a repeating timer under 10ms will actually hog a lot of CPU. Aggressive timers were actually a problem in Mozilla for a long time before being fixed, and they are currently a problem in Safari 2. WinIE, Firefox, and WebKit nightlies basically error-correct the badly constructed page and ignore timer values of < 10ms by changing them to be 10ms.


That’s defintely something I wasn’t aware of. Not that I have any utility for a timer set below 10ms myself.

Comments

  • thomas
    thomas says:

    That’s true even for very “realtimey” stuff, like effects. For example the script.aculo.us effects engines uses a 15ms interval which equates to a maximum framerate of ~66fps.

    Thu, March 01 at 11:57 AM

Comments are closed