3 ms·
Well, according to this answer (http://stackoverflow.com/a/7701264 http://stackoverflow.com/a/7701264) V8 is about the same speed as accessing variables, howeve
by firefoxman1 14y ago
Well, according to this answer (http://stackoverflow.com/a/7701264 http://stackoverflow.com/a/7701264) V8 is about the same speed as accessing variables, however I would bet looking up properties higher up the prototype chain would take a performance hit.
- gillespie 14y agoI was thinking more that if you repeatedly access a property, regardless of where in the prototype chain it is, the optimiser would cache the value, so it would be equivalent to saving it in a local variable. If I'm not mistaken, this is a common feature in optimizing compilers. I don't know how aggressive the JIT js compilers are, however.
- firefoxman1 14y agoHmm that's pretty interesting. I don't really like to depend on the engine for optimizations because you never know what JS engine people have, but it's good to know they do that.