3 ms·
If you know the shape you can reduce attribute access to an array lookup, if you don't attribute access requires a hash table lookup. That is a problem for perf
by DasIch 15y ago
If you know the shape you can reduce attribute access to an array lookup, if you don't attribute access requires a hash table lookup. That is a problem for performance and memory consumption.
- azakai 15y agoSure, but again, (1) JS engines can and do infer the shape at runtime using hidden classes, and they also get array lookups that way (and not hash table lookups), and (2) I suspect these lookups are not even on the critical path of typical performance-intensive code, but that's speculation of course.