Interesting results, but I think the farther you go down the list the more the fact that you're using the Computer Language Benchmark Game affects what you're seeing, as not all languages get the same attention. For example, Javascript and Typescript. Theoretically, I would assume those to be very close, since one compiles to the other. And for memory usage, they are very close. But for running time, Typescript is an…
> Theoretically, I would assume those to be very close, since one compiles to the other. I don't think that's a safe assumption. The Javascript results would be a lower bound (assuming the same algorithm, etc.), but there's no telling what "extra" Javascript (and thus overhead) might be inserted by the Typescript compiler. As far as individual results go, there's no point jumping to conclusions when the results and c…
Which Programming Languages Use the Least Electricity? (2018)
81–90 of 267 posts
Re: Which Programming Languages Use the Least Electricity? (2018)
#82Earlier quoted context omitted.
You can write literally any JavaScript program with TypeScript (falling back to the `any` type if you really need to), so this doesn't really work in this case. Also, typical TypeScript programs are faster than typical JavaScript programs, because JavaScript JITs like predictable object shapes and monomorphic functions for the same reasons that other language implementations require them. Libraries like lodash and bl…
>typical TypeScript programs are faster than typical JavaScript programs Person who works on js engines here :) You would think this is the case, but in actuality, js and ts are about on par in performance (assuming similarly written code). This is in fact due to the fact engines optimize for idiomatic js patterns, not idiomatic typescript patterns. often these will align, but in some cases (usually revolving around…
Re: Which Programming Languages Use the Least Electricity? (2018)
#83Not sure what to make of this research. It's not like I can switch out JS in favor of these other languages (many of which are compiled binaries) in my web apps. The performance of for example web servers written in the different languages entirely would seem more interesting to compare. The JS/TS comparison was directly fishy. I found no mention in the paper of how they managed to "run" the tasks in Typescript, whic…
Maybe you can switch it out :) https://webassembly.org/
Re: Which Programming Languages Use the Least Electricity? (2018)
#84Earlier quoted context omitted.
It took me about a minute looking at their published detailed data to notice the problem. They should have noticed a factor-of-15ish outlier and checked why on earth it was there.
That's not how the game works. The community "plays the game" by submitting better benchmarks when they come up with better solutions.
Re: Which Programming Languages Use the Least Electricity? (2018)
#85This study is a bit silly, I had to check whether it was an April Fool's joke. The chipset running the instructions is going to have a far higher impact on energy usage than the language compiling those instructions. For instance, switching to ASICs or even FPGAs that are optimized to handle certain types of computations. Just look at datacenters or mobile devices. Sure, optimizations are made to runtime environments…
Or to put it another way. Why do you think mobile devices almost exclusively use ARM? Why do datacenter operators invest heavily in R&D for ASICs instead of engineering new languages or runtimes? Because languages play a secondary role in energy consumption.
This study is just like countless of other meaningless benchmarks seen in language war flame posts. Pointless and misses the big picture.
Re: Which Programming Languages Use the Least Electricity? (2018)
#86Interesting results, but I think the farther you go down the list the more the fact that you're using the Computer Language Benchmark Game affects what you're seeing, as not all languages get the same attention. For example, Javascript and Typescript. Theoretically, I would assume those to be very close, since one compiles to the other. And for memory usage, they are very close. But for running time, Typescript is an…
> Theoretically, I would assume those to be very close, since one compiles to the other. I don't think that's a safe assumption. The Javascript results would be a lower bound (assuming the same algorithm, etc.), but there's no telling what "extra" Javascript (and thus overhead) might be inserted by the Typescript compiler. As far as individual results go, there's no point jumping to conclusions when the results and c…
Re: Which Programming Languages Use the Least Electricity? (2018)
#87Earlier quoted context omitted.
You can write literally any JavaScript program with TypeScript (falling back to the `any` type if you really need to), so this doesn't really work in this case. Also, typical TypeScript programs are faster than typical JavaScript programs, because JavaScript JITs like predictable object shapes and monomorphic functions for the same reasons that other language implementations require them. Libraries like lodash and bl…
So why is the TypeScript bench slower?
Often times, these sorts of benchmarks are done with prejudice (not necessarily malice). The benchmarks are written by someone with something to prove: my chosen tech stack performs better, and let me show you why. A favorite of mine is Perl vs Python comparisons, where you see an idiomatic Perl implementation vs a non idiomatic Python implementation (or other way around). Typically in a head-to-head comparison, the benchmarks are developed by the same individual whom likely has above average knowledge in their favorite and below average in the target they're trying to show as inferior.
You'll see this time and time again in internet benchmarks comparing performance. Unless you can see the code from all benchmarks involved, my suggestion is to avoid them. I mean, for all I know, the author of the benchmark was unaware of the built in sort and instead bubble sorted.
Re: Which Programming Languages Use the Least Electricity? (2018)
#88Interesting results, but I think the farther you go down the list the more the fact that you're using the Computer Language Benchmark Game affects what you're seeing, as not all languages get the same attention. For example, Javascript and Typescript. Theoretically, I would assume those to be very close, since one compiles to the other. And for memory usage, they are very close. But for running time, Typescript is an…
> Theoretically, I would assume those to be very close, since one compiles to the other. I don't think that's a safe assumption. The Javascript results would be a lower bound (assuming the same algorithm, etc.), but there's no telling what "extra" Javascript (and thus overhead) might be inserted by the Typescript compiler. As far as individual results go, there's no point jumping to conclusions when the results and c…
That's true, but the fact we're talking about an order of magnitude running time difference is what lead me to think it's not as easily explained as that.
> there's no point jumping to conclusions
Respectfully, I don't think I did. I put out a theory, with my reasoning, fully acknowledging where it might be wrong. As someone that doesn't use TypeScript (and I wouldn't consider myself in expert in JavaScript either), I don't feel qualified to assess the respective algorithms for those languages in the benchmarks game, so I brought the issue to a larger audience so someone else might take a look if so inclined.
> Typescript is still 2-3x slower than Node in several of the benchmarks, and the results could have been different in May 2018 when the article was written.
That doesn't really invalidate my theory, as it's possible those are also instances where it's lagging in a good submission. Given that there are several tests where it actually beats the fastest JavaScript algorthim submitted, that seems at least plausible.
Re: Which Programming Languages Use the Least Electricity? (2018)
#89Earlier quoted context omitted.
> Theoretically, I would assume those to be very close, since one compiles to the other. I don't think that's a safe assumption. The Javascript results would be a lower bound (assuming the same algorithm, etc.), but there's no telling what "extra" Javascript (and thus overhead) might be inserted by the Typescript compiler. As far as individual results go, there's no point jumping to conclusions when the results and c…
Typescript is a superset of Javascript, you can literally submit the faster JS programmes as the TS ones.
Re: Which Programming Languages Use the Least Electricity? (2018)
#90> A faster language is not always the most energy efficient My rule of thumb now is that memory access, not compute, is the primary consumer of energy. That would tend to confirm the above statement while also supporting the data that scripting languages aren’t super energy efficient, since they tend to do a lot more dynamic allocation than compiled languages, when generally broadly speaking about common programming…