5 ms·
The title doesn't exactly reflect the contents. It should have been "modern programming language that aims for high performance require generics", which is in m
by lifthrasiir 4y ago
The title doesn't exactly reflect the contents. It should have been "modern programming language that aims for high performance require generics", which is in my opinion close to the truth. It is a different matter whether a modern programming language should aim for high performance or not.
- adgjlsfhk1 4y agowell, the 2 main reasons to make a new language are higher performance and higher productivity. Generics are a clear win for productivity, but there's less widely available info on their affect on performance.
- kaba0 4y agoC++ can be plenty faster than C, not in small part due to its templates.
- eterevsky 4y agoModern programming languages that don't aim for high performance can just resort to duck typing or a similar way to emulate generics at runtime.
- lifthrasiir 4y agoStatic vs. dynamic typing has nothing to do with performance. You can have a reasonably performant implementation with dynamic typing, or conversely a statically typed language with zero concern about performance.
- jstimpfle 4y agoThat's empirically not true. The dynamic language (implementation) that is closest to static typing performance is probably Javascript, and it achieves this using an absurd amount of work to infer static types and to jit the code. If instead you make the reasonable assumption that dynamic typing => pointer indirection, and look at how memory works in modern machines, it's also theoretically untrue for a huge number of programs.
- lifthrasiir 4y agoNot every code is written with performance in mind. In fact, most aren't. This alone gives much leeway for dynamic languages; if you can make more performant program easier to write, they can pay off even when their maximum performance is limited (this is my definition of "reasonably performant"). The exact amount of leeway will of course depend on circumstances but I guess 10x is a fair estimate, which many JIT implementations can reach---not just crazy beasts like JS engines.