maximum execution time for javascript

Posted by Andrew Chang on Stack Overflow See other posts from Stack Overflow or by Andrew Chang
Published on 2010-06-12T20:42:56Z Indexed on 2010/06/12 20:52 UTC
Read the original article Hit count: 408

Filed under:
|
|
|

I know both ie and firefox have limits for javascript execution here:

hxxp://support.microsoft.com/?kbid=175500 Based on number of statements executed, I heard it was 5 million somewhere in ie

hxxp://webcache.googleusercontent.com/search?q=cache:_iKHhdfpN-MJ:kb.mozillazine.org/Dom.max_script_run_time+dom.max_script_run_time&hl=en&gl=ca&strip=1 (google cache since site takes forever to load for me) based on number of seconds in firefox, it's 10 seconds by default for my version

The thing I don't get is what cases will go over these limits:

  1. I'm sure a giant loop will go over the limit for execution time

  2. But will an event hander go over the limit, if itself it's execution time is under the limit but if it occurs multiple times?

Example:

Lets say I have a timer on my page, that executes some javascript every 20 seconds. The execution time for the timer handler is 1 second. Does firefox and ie treat each call of the timer function seperatly, so it never goes over the limit, or is it that firefox/ie adds up the time of each call so after the handler finishes, so after 200 seconds on my site (with the timer called 10 times) an error occurs even though the timer handler itself is only 1 second long?

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about error