Live data from Hacker News

Energy Efficiency Across Programming Languages

sites.google.com

41–50 of 143 posts

Re: Energy Efficiency Across Programming Languages

#41
post #5

A real shame that Forth wasn't included in the tested languages. Chuck Moore has been an advocate for more energy efficient computation for a while now.

The tests come from the benchmark game. If you want to see Forth, implement the tests in Forth: http://benchmarksgame.alioth.debian.org/

> The tests come from the benchmark game. If you want to see Forth, implement the tests in Forth:

But perhaps archive your code elsewhere. Github? Lots of language communities participated in past versions of the game. Like gforth and bigforth on shootout.alioth.debian.org circa 2008. Now it seems little remains but a few archive.org snapshots without source. Though perhaps all of that code was archived somewhere else that I'm not quickly finding?

Re: Energy Efficiency Across Programming Languages

#44
post #40

Earlier quoted context omitted.

performance usually == energy efficiency on modern cpus. race to shutdown.

Does your comment agree or disagree with what they measure?

The implementations in the benchmark game are all targeting performance.

This will almost always also be the most energy efficient thing on modern cpus.

It will not always be the most memory efficient way. I neither agree or disagree with what they are measuring, its just data. I would not look at this if I was trying to get an idea of what languages are most memory efficient, maybe.

Re: Energy Efficiency Across Programming Languages

#45

Why is TypeScript so much less efficient than JavaScript?

Guess: its output has more lines of JS than the vanilla JS versions, and since a lot of the variation between scripting languages in these things often come down to how fast they can stop running themselves and start running some underlying C, those extra lines hurt it.

This may also explain why JS is really fast in a couple of the examples. Those script likely do almost nothing but call some built-in function that does all its work in C (or C++, or whatever).

[EDIT] OK, if I'm reading these[1][2] files correctly, it has more to do with the the TS version being written in "modern" "idiomatic" "beautiful" JS with promises and crap, and the vanilla JS one being written in "ugly" "bad" old-school 90's-lookin' C-ish Javascript.

[1] https://github.com/greensoftwarelab/Energy-Languages/blob/ma...

[2] https://github.com/greensoftwarelab/Energy-Languages/blob/ma...

Re: Energy Efficiency Across Programming Languages

#46
post #2

According to their normalized "global" results, something interesting i see: 1. Pascal, surprisingly, the most memory efficient of all. I should take a look at the implementation they used. 2. Rust a good alternative to C which leads in "energy efficiency" and speed. 3. Common Lisp most energy-efficient and fastest and smallest memory footprint of all the dynamic programming languages in the list -- like Python, Ruby…

> 4. PHP, JRuby, Ruby, Typescript, Perl, Python, being massively slow than the fastest languages, for example Ruby being 59 times slower than Rust or C.

Take a look at some of the TypeScript code and compare it to the Javascript versions. At least some are way different, i.e. the TypeScript uses "modern" JS features and the JS version... looks about as much like C as it can.

Re: Energy Efficiency Across Programming Languages

#47
post #9

I am curious to know, if there is any explanation for why java performs better than Go.

I can't speak to the Java comparison, but the site says they used Go 1.6.3. The SSA back end introduced in Go 1.7 (amd64) came with a nice performance boost.

https://blog.golang.org/go1.7

Re: Energy Efficiency Across Programming Languages

#49

On of the things with the C set is they didn't use Intel's icc. On our main application (which involved a lot of heavy duty number crunching) it speeds up our application by 100% over the best we can get out gcc.

I've seen 20% speedups with icc over gcc; but not a doubling. Is this including mkl over some other numeric library as well?

No nothing extra. The code does vectorise well. But even if the result is 20%, it would make quite a bit of difference to the results presented in this paper.

Re: Energy Efficiency Across Programming Languages

#50
post #40

Earlier quoted context omitted.

Does your comment agree or disagree with what they measure?

The implementations in the benchmark game are all targeting performance. This will almost always also be the most energy efficient thing on modern cpus. It will not always be the most memory efficient way. I neither agree or disagree with what they are measuring, its just data. I would not look at this if I was trying to get an idea of what languages are most memory efficient, maybe.

I wondered if you'd looked at all ;-)
Post reply on HN