I'm not comfortable in general with such reflexive micro-optimizations,
especially those that involve second guessing the
compiler-as-it-happened-to-behave-last-time-I-checked.

On Thu, Nov 20, 2008 at 9:20 AM, John Tamplin <[EMAIL PROTECTED]> wrote:

> On Thu, Nov 20, 2008 at 9:09 AM, <[EMAIL PROTECTED]> wrote:
>
>> In cases where you expect the conditional to return false most of the
>> time,
>> using | instead of || avoids branches, which is faster.
>>
>
> That can be true in native code if the compiler's branch prediction is
> wrong, but is it actually true in JS?  I would expect the interpreter to
> have so many branches in expression evaluation that you don't pay any more
> here, and the early-out case would be significantly faster.
>
> --
> John A. Tamplin
> Software Engineer (GWT), Google
>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
http://groups.google.com/group/Google-Web-Toolkit-Contributors
-~----------~----~----~----~------~----~------~--~---

Reply via email to