20 ms·
> The list places JavaScript at a score of 4.45 and TypeScript worse at 21.5. For reference, C, the most energy efficient it 1.0 The point is that TypeScript i
by BackBlast 3y ago
> The list places JavaScript at a score of 4.45 and TypeScript worse at 21.5. For reference, C, the most energy efficient it 1.0
The point is that TypeScript is JavaScript with typing syntax added on top. There is a transpile step into JS. That's how TypeScript works. The runtimes are exactly the same. Unless we're also measuring the build step? Which seems silly.
The difference should be near zero. And it's not. They clearly do not understand exactly what they are measuring.
- andsoitis 3y agoOne explanation is that the typical JS output by the TS compiler is more verbose (so more code to load, parse, and run). On the other hand, one can imagine that the TS compiler’s catching classes of errors at compile time means fewer runtime exceptions. I think the takeaway, however is the theme of a spectrum of energy efficiency, with compiled languages being more efficient than those that are not. But I still maintain that the overall efficiency of a system is more a function of other factors.
- BackBlast 3y agoMy take away is that this list is very unreliable.
- soegaard 3y agoI don't know what the usual speed difference of TypeScript programs vs JavaScript programs. But the argument that TypeScript generates a JavaScript, so it must have similar speed doesn't hold in general. If the compiler in question is a whole-program compiler, it can make optimizations that a normal person couldn't do. As an anecdote in [1] a raytracing program were implemented in both Scheme and C. The Stalin compiler (a whole-program Scheme compiler) produced an executable 45% faster than the one produced by g++. The Stalin compiler produced the excecuable by compiling Scheme to C, and then used a C compiler to produce the final executable. The price of a whole-program compiler? Well, the compile time are huge. [1] Scroll to Siskind's comment. https://groups.google.com/g/comp.lang.scheme/c/NJxRsdMNKz4 https://groups.google.com/g/comp.lang.scheme/c/NJxRsdMNKz4 For those curious about the actual programs and results: https://web.archive.org/web/20071011073406/http://www.ffconsultancy.com/languages/ray_tracer/index.html https://web.archive.org/web/20071011073406/http://www.ffcons...
- deleted 3y ago[deleted]
- igouy 3y ago> with typing syntax Programs that didn't type check were excluded. https://github.com/greensoftwarelab/Energy-Languages/issues/3#issuecomment https://github.com/greensoftwarelab/Energy-Languages/issues/...