Comment #5 on issue 2513 by [email protected]: life benchmark slowness
http://code.google.com/p/v8/issues/detail?id=2513

I agree code size is a minor issue here, yeah. ?1:0 is small and especially with gzip will be practically nothing since it repeats a lot.

But I am more worried about optimizations and interactions with other optimizations. Replacing

  i2 = i1 > 5;

with

  i2 = i1 > 5 ? 1 : 0;

turns into a branch, doesn't it? And probably a poorly-predicted branch, since this is for a general condition check, there's no reason to assume it would always be in the same direction, so it is definitely not optimal especially inside tight loops. Unless JS engines do something specific to the pattern of

  boolean ? 1 : 0

to remove the branch, but if we are talking about specific optimizations, wouldn't it be simpler to specifically optimize

  boolean | 0

(which has the same semantics in JS, is shorter, and doesn't imply a branch)?


--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to