3 ms·
An example that shows that Javascript wasn't designed for performance: it doesn't support integers. They can be used in some Javascript implementations that do
by jules 15y ago
An example that shows that Javascript wasn't designed for performance: it doesn't support integers. They can be used in some Javascript implementations that do smart tricks to convert float arithmetic to integer arithmetic, but it is not reliable. If you were designing a language for performance in the first place, this would be a ridiculous method to get access to integers. Same for dense arrays. Yeah, JS is pretty fast if you know how the particular implementation that you're targeting works, but even then there are many things that just need a lot more performance than JS can offer.
On the expressiveness front: Javascript doesn't support proper lexical scoping. It's object model is broken. It doesn't use proper abstractions in the standard library. Etc. These can all be fixed by compiling another language to Javascript, but then you lose on the performance side.
- cpr 15y agoDense arrays are coming in Harmony, thanks to WebGL. (JS.next) CoffeeScript incurs no penalty when compiling to Javascript; in fact, in many cases it's faster than handwritten code.
- chc 15y agoCoffeeScript is only kinda "another language." It's very intentionally designed to map closely to JavaScript. Try it with an actual independent language like Python, Ruby or Haskell and you'll have more trouble.
- jules 15y agoYea, Coffeescript incurs no penalty because it's so close to Javascript, but therefore it doesn't fix Javascript's flaws either. Coffeescript still doesn't have proper lexical scoping and it doesn't have a good standard library.
- cpr 15y agoIt sure fixes a lot of the expressiveness problem.