Ah yes, deleted properties is a big difference. If I add a hasOwnProperty() check to the 2nd example they are within 0.5% of each other for better or worse. I think that explains it, thank you for pointing that out!
On Tue, Nov 29, 2011 at 6:13 PM, Kevin Millikin <[email protected]>wrote: > Hi Marcel, > > One potential difference is that we optimize the second case. The > optimizing compiler does not (yet) optimize for...in. > > Another difference is that for...in is complicated, not just by searching > the prototype chain, but also by having to cope with deleted properties. > So we have to 'lazily' generate the properties, still preserving their > order. > > -- > v8-users mailing list > [email protected] > http://groups.google.com/group/v8-users -- v8-users mailing list [email protected] http://groups.google.com/group/v8-users
