← Back to context

Comment by Betelbuddy

2 months ago

The efficiency...

https://users.rust-lang.org/t/energy-consumption-in-programm...

I see that's from almost 10 years ago, it would be interesting to see how that's changed with improvements to V8, python and C# since.

Also, Typescript 5 times worse than Javascript? That doesn't really make sense, since they share the same runtime.

  • Why is that so unbelievable? TypeScript isn't JavaScript, and while they have the same runtime, compiled TypeScript often don't look like how you'd solve the same problem in vanilla JS, where you'd leverage the dynamic typing rather than trying to work around it.

    See this example as one demonstration: https://www.typescriptlang.org/play/?q=8#example/enums

    The TS code looks very different from the JS code (which obviously is the point), but given that, not hard to imagine they have different runtime characteristics, especially for people who don't understand the inside and outs of JavaScript itself, and have only learned TypeScript.

This image comes from running the different versions of the benchmark games programs. Some of the difference between languages may actually be just algorithmic differences, and also those programs are in general not representative of most of the software that runs.