3 ms·
No, they're just sugar. It has no relation to whether you can use them to optimise things or not.
by TazeTSchnitzel 14y ago
No, they're just sugar. It has no relation to whether you can use them to optimise things or not.
- Offler 14y agoIt's called Type Specialization http://dl.acm.org/citation.cfm?id=1542528 http://dl.acm.org/citation.cfm?id=1542528
- asynchrony 14y agoClass declarations will be equivalent (can be desugared to) a function declaration and some manipulations of the function's prototype. JS VMs already optimize this pattern, so why should syntax sugar for classes be anything special for the compiler?
- Offler 14y agoBecause it takes time and CPU cycles for them to figure out what is a Type and what is not. They don't know how much memory to allocate to these objects for instance, but now with classes they will know types immediately.