Re: The Why's of Loop Unrolling
BY <[email protected]> Sat, 11 Nov 2006 23:03:58 -0500
| Newsgroups | gmane.comp.web.dom.wdf |
|---|---|
| Message-ID | <[email protected]> |
Chris, You are correct, JS is invariably translated into compiled commands but since it's not a one to one translation, and there's a lot of optimization, rearrangement, etc that happens between JS being interpreted and executed at machine level, low-level optimization like loop unrolling does little. What does make a difference is lowering the number of operations / loop. Even when writing assembly, loop unrolling begins to make sense when the overhead for the loop iteration and branching is close to the time the loop instructions take. So it makes a lot more difference when you can slim down the # of instructions / loop. This is what I saw on that page (without going back and looking at all of the examples again) is the timing compared two different things .. in the faster examples, there were fewer # of instructions / loop. -- Ben V. Y. On 11/10/06, Chris <[email protected]> wrote: > > Hi BY, > > Since JS is interpreted, not compiled > But again, it's ultimately interpreted into compiled commands. For > conclusive results you need merely test the approach - and as you can > see on this page the results are a significant speed increase. > > > The link you reference actually accomplishes > > gains by reducing operations / loop (using variables with precalc'd > > values). > You have to scroll to the bottom for the loop-unrolling techniques. Many > are presented on the page. > > > [Non-text portions of this message have been removed]