Live data from Hacker News

Which Programming Languages Use the Least Electricity? (2018)

thenewstack.io

211–220 of 267 posts

Re: Which Programming Languages Use the Least Electricity? (2018)

#211
post #106
post #14

Earlier quoted context omitted.

That’s an interesting discrepancy, I might have had the same gut reaction. But you’re using that assumption to cast slippery-slope doubt on the whole project without knowing anything specific. It’s possible you’re right, but maybe find out which algorithms are being used first? Perhaps there is a reason that TypeScript actually is an order of magnitude slower than JavaScript. The Benchmark Game project was specifical…

I’ve noticed similar discrepancies between Perl performance in the real world and in the suite they are using. The issue is that one of the metrics in the suite is lines of code, so people write fantastically obscure and concise functional programs in Perl when the imperative one would be 2x the LOC, but much, much faster. (This is from a spot check years ago. Maybe they’ve fixed this somehow).

Maybe you have a vague recollection of something you once saw somewhere.

The benchmarks game does not measure LoC --

https://benchmarksgame-team.pages.debian.net/benchmarksgame/...

Re: Which Programming Languages Use the Least Electricity? (2018)

#212

Earlier quoted context omitted.

This may be a dumb question as I know nothing about Typescript, but is it idiomatic to do that, though? You can, for the most part, use C in C++. But if C was beating the pants off of C++ in benchmarks it wouldn't tell me anything useful if someone submitted a C program as the C++ benchmark. If I wanted to use idiomatic C, I'd use C. I expect a C++ vs. C comparison to compare the encouraged features of C++ with what'…

The benchmark is flawed. It should compare the fastest possible C++ implementation and a more idiomatic C++ implementation. The entire purpose of the language is to allow both to coexist in the same code-base. I would be very surprised if the fastest C++ and C are actually different.

If the benchmark claimed to be perfect then "flawed" would be an important criticism.

You can see 4 or 5 C++ fannkuch-redux programs "compared"

https://benchmarksgame-team.pages.debian.net/benchmarksgame/...

Re: Which Programming Languages Use the Least Electricity? (2018)

#213
post #13

Earlier quoted context omitted.

submit a better implementation. it is not possible for any one entity to produce optimal implementations for many languages, it is up to us. or, if you dont like their rules, make your own benchmark system with new rules.

I don't use Typescript, and use Javascript only for what I have to. I don't care about the ranking of either of them, I'm just pointing out a possible flaw in the methodology that should be taken into account when looking at the numbers presented, and what I suspect is a concrete example of that. This also isn't a criticism of the benchmark game, it's well known that not every implementation is equivalent in the time…

> Unfortunately, using it as the base of further calculations can lead to some of the known quirks of the benchmarks being exaggerated

You seem not to have considered the possibility that the authors may have simply made a mistake, unrelated to the origin of the programs.

The authors presented at an Oct 2017 conference. Archived benchmarks game web-pages from 2017 do not show the 10x fannkuch-redux differences that the authors report --

https://web.archive.org/web/20170918163900/http://benchmarks...

Re: Which Programming Languages Use the Least Electricity? (2018)

#214
> We then gathered the most efficient (i.e. fastest) version of the source code in each of the remaining 10 benchmark problems, for all the 27 considered programming languages.

I wonder if anyone has attempted to rate how idiomatic or typical CLBG entries are, and whether choosing the most idiomatic implementation for each language would have obtained different results?

Re: Which Programming Languages Use the Least Electricity? (2018)

#215
post #42
post #34

Earlier quoted context omitted.

> I did not know if my concern was correct, and wondered if it was, what else it might affect. That’s exactly what I mean by casting doubt. If the concern might not be correct, why lead into speculation about further concerns? Let’s find out what the actual reason that TypeScript is measured slower, rather than guess as what else could be wrong if unverified theoretical assumptions might be correct.

> rather than guess as what else could be wrong if unverified theoretical assumptions might be correct. You mean, I should not have explored the ramifications of what my suspicions might mean to so people might think it's worth actually looking into? What's wrong with that? I can't help but feel that you feel compelled to defend your original position that I believe was based on a misinterpreting my point and intenti…

You seem not to have considered the possibility that the authors may have simply made a mistake, unrelated to the origin of the programs.

The authors presented at an Oct 2017 conference. Archived benchmarks game web-pages from 2017 do not show the 10x fannkuch-redux differences that the authors report --

https://web.archive.org/web/20170918163900/http://benchmarks...

Re: Which Programming Languages Use the Least Electricity? (2018)

#216
post #64

The big surprise for me is where Perl stands in the rankings, below Javascript in all three tests.

Amen: I'd have to take a look at the actual code in use.

You can, the authors of the paper provide the actual code they used on their website.

Re: Which Programming Languages Use the Least Electricity? (2018)

#217
post #35

Really silly to state how much electricity "languages" use without specifying implementations. You can specify for unstandardized languages, but languages don't have performance characteristics in the typical sense, implementations do, and this can very greatly between implementation.

fyi

https://sites.google.com/view/energy-efficiency-languages/se...

Re: Which Programming Languages Use the Least Electricity? (2018)

#218
post #195

Earlier quoted context omitted.

> 2- avoid using the functional primitives like map I understand that map requires creating a new array, and that is already included in point 1. What overhead are functional primitives subject to apart from memory allocation? e.g. forEach

Using continuations. The function call itself and the local scope wrapped up into it can be varying degrees of expensive. When little state, because it’s inline or nearby for example, it might be optimized down to near what a for loop does. But if there’s a function call at all once it’s executed, that alone is slower than the for loop. Remember it’s a function call per element. If the function is further away with m…

If I modify that code to pre-initialise an array with the values 0 to N - 1, and then copy the value from that array to a new array (rather than using the loop index), then both map and forEach are faster than the for loop for me.

Re: Which Programming Languages Use the Least Electricity? (2018)

#219
post #65

Earlier quoted context omitted.

it is absolutely a flaw in the methodology, but one I think is unavoidable without enormous resources.

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.

If we assume they understood the relationship between JavaScript and TypeScript then maybe it should have been noticed.

However, the original research has been posted multiple times to proggit and HN since 2017; and I don't recall whether or not anyone noticed this problem until now --

https://news.ycombinator.com/item?id=15249289

https://www.google.com/search?q=energy+efficiency+programmin...

Re: Which Programming Languages Use the Least Electricity? (2018)

#220
post #122

I always feel like there is a big misunderstanding of what it means to “write a program in some language” in these types of comparisons. For example, saying that Python uses much more energy is a foolish thing to say. The “same” algorithm written in pure Python is a very semantically different thing. It involves allocation of flexible objects that obey certain attribute lookup protocols, operator protocols, dynamic a…

Yes except some people are using python where they should be using C++ and powet consumption is a good reason not to use python in these cases.

No, it’s a good reason to use Cython or one of the many other techniques for generating pre-compiled C extensions in the Python ecosystem. You may also use C++ directly or something if you prefer, but there would not be any performance based reason to do so.
Post reply on HN