I want to benchmark some Javascript code in the browser, but it may trigger Firefox's "Warning: Unresponsive script" popup. This allows the user to click "Stop script" in the event that the browser is caught in a runaway function. While the pop-up is displayed, the currently running function has been halted. This isn't ideal, so is there a way to run my benchmarks differently such that Firefox doesn't popup this warning and ruin my results?
views:
580answers:
4
+2
A:
You have to break up long actions into smaller ones and perform them in turns. This will also allow a better progress indication.
Nick Brooks
2009-12-16 20:21:23
Can you elaborate? A simple example, maybe?
spoulson
2009-12-16 20:25:05
Here's an example of using setTimeout to break up the running of the javascript: http://www.sonofsofaman.com/hobbies/code/settimeout.aspIf you're doing benchmarks, make sure that you allow the code to run long enough to make up for the timer resolution. You'll probably want to read this: http://ejohn.org/blog/accuracy-of-javascript-time/
Annie
2009-12-16 20:31:08
+4
A:
In firefox's address bar type about:config
You want to change dom.max_script_run_time to be large enough for your scripts to run.
tloach
2009-12-16 20:22:05
+1
A:
You can use the script from this question to break processing long lists into smaller chunks:
Diodeus
2009-12-16 20:43:01
+2
A:
See in blog of Nicholas C. Zakas What determines that a script is long-running? (at 2009/01/05)
Speed up your JavaScript, Part 1 http://www.nczonline.net/blog/2009/01/13/speed-up-your-javascript-part-1/
there are the reasons and the ways how to avoid the dialog
zmila
2009-12-17 13:20:56