I wrote javascript to emulate the WPF DockPanel Layout behavior in HTML using javascript.
Now I run into performance issues when I start pasting these panels at recursion level 10. Oddly enough, this is nothing more than regular recursion, and at the deepest level, this function ends between 0.2 and 2 ms.

Now either I have a ghost performance loss, or is there a huge cost when calling recursion for javascript? I hope one of you knows.
If there is value, then the obvious solution would be a reversal of recursion, which would be rather sad.
I read a SO recursive function calling in JavaScript about this, but does it really mean that I may have to take recursiondepth n = functioncost * (10 ^ (n-1)) for each recursion depth will I go?
Also, this (which disproves the idea of ββrecursion more slowly than iteration) SO - Is it faster than recursion, or less prone to stack overflows?
And this Programmers: Performance: recursion versus iteration in Javascript , which speaks for iteration faster than recursion, 4 times (sigh ...)
This is a general JS browser independent issue. If you know about this, be it slow in one, but fast in the other, that information would also be welcome. I assumed that it would be the same thing.
Visitor Wrap Information: The effects of recursion and iteration are very important. The iteration generally wins.
- FF30 Factor: 5 ~
- Chrome factor 36: 40 ~
- Native IE8 WinXP Factor: 10 ~
source share