I tried running your test on IE8 and it just kept prompting me with script
unresponsive.

Allen Madsen
http://www.allenmadsen.com


On Wed, Dec 16, 2009 at 7:01 AM, Robert Kieffer <bro...@gmail.com> wrote:

> I whipped up a quick JSLitmus test to try out a handful of empty loops
> (using i++, ++i, i+=1, and a while loop:
> http://www.broofa.com/Tools/JSLitmus/tests/loop_operators.html
>
> View the [very short] source of the page to see the actual test code.  When
> running the test for yourself, be sure to uncheck the "normalize" box. Also,
> you'll probably want to run each test a few times to make sure you're
> getting consistent results (CPU load elsewhere in the OS can skew resutls).
> For more on JSLitmus, read http://www.broofa.com/Tools/JSLitmus )
>
> Here are the results I got on my MacBook (sorry, don't have IE results
> handy)
> FF: http://tinyurl.com/ykdutyk
> Safari: http://tinyurl.com/yzusg7e
> Opera: http://tinyurl.com/yjamzwc
> Chrome: http://tinyurl.com/ylylyw5
>
> Executive summary: On the above browsers, performance does vary. i++ or ++i
> are the best all-round performers, while the while() loop is generally not
> as good.  However on all of these systems ('cept Opera), looping code runs
> so fast that performance is negligable compared to whatever code you put
> inside the loop.  I.e. it's unlikely to matter in all but the most trivial
> of loops.
>
> - rwk
>
>
>
> On Wed, Dec 16, 2009 at 2:28 AM, Yaffle <vic99...@yandex.ru> wrote:
>
>> ++i; is a little more efficient in C language,
>> in javascript difference in performance of all these operators is tiny
>>
>>
>> On Dec 16, 3:21 pm, RQuadling <rquadl...@googlemail.com> wrote:
>> > Hi.
>> >
>> > Is there any consensus on which is more efficient in a for() loop?
>> >
>> > I was taught that for ++i being the most efficient.
>> >
>> > I've created 2 patches (++ and a +1) in case anyone is interested.
>> >
>> > http://pastie.org/private/3rgonpsn90yjd17q9zwa
>> > andhttp://pastie.org/private/qufy3rwmaevxc1sysvq
>> >
>> > From what I've read, this could be a little pointless, but I'm not the
>> > expert in this area.
>> >
>> > Regards,
>> >
>> > Richard.
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Prototype: Core" group.
>> To post to this group, send email to prototype-core@googlegroups.com
>> To unsubscribe from this group, send email to
>> prototype-core-unsubscr...@googlegroups.com
>> For more options, visit this group at
>> http://groups.google.com/group/prototype-core?hl=en
>>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Prototype: Core" group.
> To post to this group, send email to prototype-core@googlegroups.com
> To unsubscribe from this group, send email to
> prototype-core-unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/prototype-core?hl=en
>

-- 
You received this message because you are subscribed to the Google Groups 
"Prototype: Core" group.
To post to this group, send email to prototype-core@googlegroups.com
To unsubscribe from this group, send email to 
prototype-core-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-core?hl=en

Reply via email to