func5000 - how far does your UA get?
Wednesday, November 28, 2007 7:01:47 PM
func5000.htm
I'd really like to know if there is a hard-coded limitation or if it depends on system speed and memory, for example. Discussion is open in the comments
the web is a hack
Wednesday, November 28, 2007 7:01:47 PM
what I take for granted..IE allows a semicolon between if block and else![]()
Seen Chrome's UA string recently? It's got so many browser n ...
Glad to see the jury was sensible, and the accused was not " ...
I wonder what happened when Chrome hit the double digit, IE ...
Firefox goes 2-digit, time to check your UA sniffing scripts ...
The police apparently did not convince the court, so the acc ...
xkcd on Firefox
For those who need to explore key event implementations
RamūnasRamunas # Wednesday, November 28, 2007 7:05:25 PM
With firefox I get "- died when trying to call function 1000, error was "too much recursion""
Scottscottj # Wednesday, November 28, 2007 7:49:22 PM
Dan Alexandrudantesoft # Wednesday, November 28, 2007 8:09:40 PM
"function 4998 running" on Opera 9.50.9665.0
IE 6.0.2900.2180 reports '- died when trying to call function 1124, error was "Out of stack space"'
Fx 2.0.0.10 reports: '- died when trying to call function 1000, error was "too much recursion"'
Safari 3.0.3 reports: '- died when trying to call function 98, error was "Maximum call stack size exceeded."'
PS: May I suggest uploading it as test.html.gz ?
RamūnasRamunas # Wednesday, November 28, 2007 8:10:31 PM
Daniel Goldmandanigoldman # Wednesday, November 28, 2007 8:27:23 PM
Jeff WaldenWaldo # Wednesday, November 28, 2007 8:32:17 PM
Dan Alexandrudantesoft # Wednesday, November 28, 2007 8:40:43 PM
Opera 9.50.9665.0 Iteration depth: 9998
FX 2.0.0.10 Iteration depth: 1000
Safari 3.0.3 Iteration depth: 99
By putting a "window.status = n" in front of "recur(n + 1)", it's possible to see the result in IE6, too: I get an iteration depth of 1124
The Leaf # Wednesday, November 28, 2007 9:17:56 PM
Error: "Maximum call stack size exceeded."
But the smallest result I could get was under Adobe Air(uses WebKit, well, at least a very old version from mid 06 or so), after 98 calls it stopped.
ct13 # Wednesday, November 28, 2007 9:51:56 PM
Holger Dorsdors # Wednesday, November 28, 2007 10:06:03 PM
- died when trying to call function 498, error was "Maximum call stack size exceeded."
Opera 9.24 Build 3707 on Mac OS X 10.5.1:
function 2498 running
Olegmelnichuck # Wednesday, November 28, 2007 10:12:48 PM
System: Windows XP
Java: Sun Java Runtime Environment version 1.6
TEST RESULTS, sorted by time
Opera 9.50 9665
Firefox 2.0.0.9
Netskape Navigator 9.0b1
{...full code displayed and... } /* this is function 4835 */Safari 3.0.3
MSIE 5.01
MSIE 5.5
MSIE 6
MSIE 7
Michael A. Puls IIburnout426 # Wednesday, November 28, 2007 10:25:44 PM
On a slightly similar note, try the TC in this bug to watch Safari and IE6 die, Opera and IE7 throw an exception and FF handle it just fine.
FataL # Wednesday, November 28, 2007 10:32:45 PM
Firefox 3.0b2pre
AyushAyushJ # Wednesday, November 28, 2007 10:42:54 PM
Minefield/3.0b2pre -
Opera 9.24.8816 -
IE 7 -
Windows XP/SP2 - 256MB Ram
Kelson VibberKelson # Wednesday, November 28, 2007 11:08:35 PM
Opera 9.5 alpha: function 4998 running
Firefox 3 beta 1: completed all 5000.
Epiphany (running Gecko 1.8.1.9, equiv. to Firefox 2.0.0.9): stopped at 1000 with "too much recursion"
Konqueror 3.5.8: - died when trying to call function 998, error was "Exceeded maximum function call depth."
On Windows XP (768 MB RAM, 2.93 GHz Celeron):
Safari 3.0.4: - died when trying to call function 498, error was "Maximum call stack size exceeded"
IE7: - died when trying to call function 2550, error was "Out of memory"
No change on IE7 when I closed some more apps to free up memory.
David Anderssonliorean # Thursday, November 29, 2007 2:33:54 AM
kestrel (b9624): function 4998 running
merlin (9.24): function 2501 running
op 7.52 (b3808): function 1672 running
ie6: - died when trying to call function 1124, error was "Out of stack space"
saf 3.0.4b: - died when trying to call function 498, error was "Maximum call stack size exceeded."
ff2.0.0.10: - died when trying to call function 1000, error was "too much recursion"
ff3.0b1: function 5000 running - FINISHED! 5000 function calls took 264ms
Using waldo's test:
kestrel (b9624): Iteration depth: 9998
saf 3.0.4b: Iteration depth: 499
ff2.0.0.10: Iteration depth: 1000
ff3.0b1: Iteration depth: 228816
Kyle Bakerkyleabaker # Thursday, November 29, 2007 9:00:41 AM
-First message was:
"FAILED (seems stresstest script did not even parse.. though please wait a few seconds..)"
-Then..
"function 4998 running"
..I hope we can reach the 5000 mark soon! Looks like we have some catching up to do (at least a little bit...ff3).
Firefox 2.0.0.10 (x64)
'- died when trying to call function 1000, error was "too much recursion"'
Firefox 3 (Win32)
"function 5000 running - FINISHED! 5000 function calls took 313ms"
IE7 (Win32)
' - died when trying to call function 2550, error was "Out of memory"'
It looks like most are hard coded I guess. Opera 9.2x seems to be getting a few different results, while 9.5x is getting constants like IE and FF did.
Ice ArdorIceArdor # Thursday, November 29, 2007 9:35:33 AM
Originally posted by Opera 9.50.9656:
Originally posted by Firefox 3 Beta 1:
Originally posted by IE7:
WinXP Pro SP2 384MB 2.2 GHz
Firefox's average time was around 550ms after refreshing.
just submitted http://browsershots.org/http://files.myopera.com/hallvors/blog/func5000.htm
MS IE 6.0 on Windows 2000 crashed (oops... I didn't mean too!); died at 1124
Safari 3.0.3 for Windows 2000 died at 98, call stack size exceeded.
Firefox 2.0.0.9 for Windows 2000 died at 1000 - too much recursion
Opera 9.24 for Windows XP - function 2504 running
opera950beta2 # Thursday, November 29, 2007 10:32:31 AM
firefox 3b1 (amd x2 (s939) @2100mhz, 2gb ddr @230mhz 2-2-2-5 1T)
others failed, seems to me clearly, that FF 3 does this test the best
James Justin HarrellHeroreV # Thursday, November 29, 2007 2:59:48 PM
Raphael Wimmerraphman # Thursday, November 29, 2007 3:19:33 PM
graste # Thursday, November 29, 2007 4:04:48 PM
- Opera 9.24: "function 2500 running"
- opera-9.50-20071109.6-shared-qt.i386-1662: "function 4998 running"
- Firefox 2.0.0.10: "- died when trying to call function 1000, error was "too much recursion""
- Wine-emulated IE6: "- died when trying to call function 500, error was "Not enough memory.""
_Grey_ # Thursday, November 29, 2007 8:25:36 PM
Didn't test other browsers.
Comment: This doesn't test recursion, though. This just tests how many different functions can be nested. A situation where you only use function recursion instead of loops shouldn't have exactly the same constraints as nested individual functions, imho. I'm just very bad at functional recursion so I can't really test it...
Also it would theoretically be possible to optimize for functions with identical function body (which you are using a ton of). So... er... maybe you should create them with Function(), give them some different number to crunch and see what happens? ;D
rsemil # Friday, November 30, 2007 3:42:54 AM
function 5000 running - FINISHED! 5000 function calls took 568ms
Hallvord R. M. Steenhallvors # Tuesday, December 4, 2007 12:38:10 AM
Also, the function bodies are not quite identical - they contain different numbers in the string that is passed to the DOM and in the name of the next function called. I don't write JS compilers myself but I'd be quite impressed if anyone could optimise for similar functions with such differences.
The various test results seem to show that most browsers have hard-coded call depth limits. The grand exception is Firefox 3, which calculates the limit dynamically. I wonder if it can give JS that much resources and still avoid a rogue script slowing down or freezing your entire system.
_Grey_ # Tuesday, December 4, 2007 8:09:20 PM
vokca_charcoal # Thursday, December 13, 2007 12:20:40 PM
James Justin HarrellHeroreV # Monday, December 17, 2007 2:51:40 AM
Firefox pops up a dialog to the user when scripts run for too long, asking if the user wants to stop the script or let it continue. But if a script wants to slow down or freeze a browser, there are much easier ways of doing it. In every browser I've ever tried, freezing the browser up indefinitely was very easy (when purposely trying to do it). I would be very impressed if Opera was the first one to put serious effort into overcoming this.
Hallvord R. M. Steenhallvors # Monday, December 17, 2007 4:47:27 PM
while(true);
and observe how the UI stays fairly responsive. Because of this we have not implemented the "slow script" warning dialog found in Firefox and (I believe) also in IE. I'm not saying that you can't make Opera's UI freeze with JS tricks but I do think you have to work a bit harder..
Kyle Bakerkyleabaker # Friday, June 20, 2008 11:36:35 PM
function 4998 running
No changes even after 9.5 final.
Kyle Bakerkyleabaker # Thursday, April 9, 2009 10:25:37 PM
Kyle Bakerkyleabaker # Thursday, December 3, 2009 5:53:06 AM
Kyle Bakerkyleabaker # Wednesday, June 2, 2010 5:59:57 AM
Opera 10.60
- died when trying to call function 16382, error was "Maximum recursion depth exceeded"
Google Chromium 6.0.423.0 (48614) Ubuntu:
- died when trying to call function 13059, error was "undefined"
Firefox 3.6.3
- died when trying to call function 3000, error was "too much recursion"
test it for yourself:
http://kyleabaker.com/temp/func20000.html.zip
Charles SchlossChas4 # Thursday, June 3, 2010 4:50:58 PM
function 5000 running - FINISHED! 5000 function calls took 3674ms
Anonymous # Sunday, August 1, 2010 7:51:45 AM
TomQyngali # Monday, August 2, 2010 1:27:34 AM
10.61 RC1 on Vista with about 70 tabs open.
Anonymous # Tuesday, August 3, 2010 9:36:12 AM
Anonymous # Tuesday, August 3, 2010 9:38:24 AM