4 ms·
On the other hand, if you ever find yourself writing a programming language, consider making it statically typed. In the world of mobile devices where CPU is b
by hamstergene 6y ago
On the other hand, if you ever find yourself writing a programming language, consider making it statically typed.
In the world of mobile devices where CPU is battery life, why create a language that is ~10x slower for no user benefit and makes people contemplate about designing the whole OS around its performance issues?
- KMag 6y agoWell, NaN boxing/NuN boxing would also allow you to more densely encode algebraic data type variants in statically typed languages in the case where at least one variant is a IEEE-754 double, some of the variants are references/pointers, and none of the variants take more than 8 bytes. Granted, it's not a common use case. Neither Rust nor OCaml use this space optimization, but they could. OCaml (at least used to, back in the early 2000s) made the maximum tuple/object size smaller in other to have some bits (8 bits, IIRC) to store the variant in the object header. I'm not actually sure how Rust decides how many bits to dedicate to encoding the variant, and I have very little knowledge of GHC internals. I'm a big fan of Rust (and to some extent, C++), but there's a ton of CPU time being spent on JavaScript execution worldwide.