4 ms·
> At the end of the day it's all JavaScript so performance is rather moot point That's probably true, but C++ does provide very powerful compile-time evaluatio
by humanrebar 12y ago
> At the end of the day it's all JavaScript so performance is rather moot point
That's probably true, but C++ does provide very powerful compile-time evaluation mechanisms like templates, constexpr (compile-time evaluated constants and functions), and template metaprogramming. That being said, compile-time C++ can look very gross since most of the features are accidental.
However, there are a lot of huge performance benefits to moving computation to compile time: selecting the most optimal algorithm for a type, guaranteeing you don't mismatch your units, precompiling search (glob, regex) engines, eliminating dead code, and so on.
So I would be shocked if at least some javascript applications couldn't be much faster and more correct by writing in C++ first and compiling to js. That being said, it's probably not in scope for a minimum-viable product, so improving already business-critical parts of the code base might be the best place to start.
- pkolaczk 12y agoMetaprogramming and type-safety facilities of C++ are very limited compared to other languages like Haskell or Scala. And for the latter there is a JS compiler as well.