Live data from Hacker News

Energy Efficiency Across Programming Languages

sites.google.com

91–100 of 143 posts

Re: Energy Efficiency Across Programming Languages

#91
post #9

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

Two decades of optimization probably account for that. From the paper:

    Moreover, the top 5 languages that need less energy and
    time to execute the solutions are: C (57J, 2019ms), Rust (59J,
    2103ms), C++ (77J, 3155ms), Ada (98J, 3740ms), and Java
    (114J, 3821ms); of these, only Java is not compiled.
That is an admirable accomplishment. JRE 1.8 has the most efficient "managed" language runtime tested.

The PHP result is interesting; they used 7.x which is roughly twice as efficient as older (5.x) versions; PHP 7 was primarily a (successful) effort to improve performance. If you extrapolate the PHP result to the old version (multiply by 2) it's nearly as bad as Perl and among the slowest/most costly. That certainly corroborates Facebook's several PHP re-implementations.

Re: Energy Efficiency Across Programming Languages

#92
post #13

Earlier quoted context omitted.

> 1. Pascal Pascal is a "hidden" gem in the area of languages. Sadly not enough pus for it, but imagine if it have the push that other languages have...

But why should it's memory utilization be so much lower? Pascal and C give the programmer basically the same control over memory layout, no?

Basically, C's semantics assume too little - everything is a primitive type or a pointer dressed up to look like something else. Pascal has a stronger notion of types and this allows for additional automatic optimization where they're relevant - memory layout just happens to be one such area.

Re: Energy Efficiency Across Programming Languages

#93
post #55
post #51

Earlier quoted context omitted.

Typescript is not its own language in terms of having a distinct runtime from Javascript so it has no performance difference and does not make sense to appear in this comparison. I can see comparing different target versions of Javascript against one another (es2015 vs es2017 for instance), but it all depends on the VM chosen as well.

Exactly. The difference at least some of these tests is measuring between the two is idiomatic modern JS (promise, map, careful variable scoping) with fast & loose old-school c-like JavaScript (for loops, global vars galore). Typescript has little to do with it.

Typescript can use only of these, so it does make sense to have it on the list. Clearly it doesn't fall right next to JavaScript in the results. It is a benchmark of language implementations not runtimes. This is why JRuby, C# and F# are on the list, one uses the JVM and the latter two both use the CLR. Different languages.

Re: Energy Efficiency Across Programming Languages

#95
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.

Yes, see several minutes starting around 01:18 in this talk:

https://www.infoq.com/presentations/power-144-chip

As for efficiency, he mentions 7 picojoules per instruction in his forth chips.

Re: Energy Efficiency Across Programming Languages

#96
post #85
post #13

Earlier quoted context omitted.

> 1. Pascal Pascal is a "hidden" gem in the area of languages. Sadly not enough pus for it, but imagine if it have the push that other languages have...

Much of Pascal (or, rather, Modula-2 and Oberon) is revived inside Go.

What parts of Pascal do you recognize in Go?

Re: Energy Efficiency Across Programming Languages

#97
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…

And Forth is missing.

Re: Energy Efficiency Across Programming Languages

#98
post #85

Earlier quoted context omitted.

Much of Pascal (or, rather, Modula-2 and Oberon) is revived inside Go.

What parts of Pascal do you recognize in Go?

The id type way instead of type id.

The way methods are attached to types appeared first in Oberon-2.

Type assertions are similar to Oberon.

The unsafe package idea is similar to SYSTEM in Oberon or Pascal.

The stronger type semantics forcing explicit casts.

Re: Energy Efficiency Across Programming Languages

#99
post #66

Earlier quoted context omitted.

"Pascal is a "hidden" gem in the area of languages" I agree. Programmers won't look at it because they perceive it to be old and out-of-date. But the language hasn't stood still. It's a fast, low-memory language. FreePascal with the Lazarus IDE is one of the best cross-platform development toolkits for building native desktop apps. Sadly a lot of programmers can never see beyond the verbose (but readable) syntax.

Maybe somebody needs to create a more palatable language, that'll transpile (I know, I know, compile) into pascal?

That was what I was looking for in Go, but they seem to have other goals in mind.

Failing that there is always Ada, .NET Native, Kotlin Native, D,...

Post reply on HN