Live data from Hacker News

Which Programming Languages Use the Least Electricity? (2018)

thenewstack.io

181–190 of 267 posts

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

#181
It would be interesting to match these results to what you get using EO-(efficiency-oriented)languages. (MOQA for example). There's a whole branch of computer science involved in static average-case analysis for algorithms and data structures. The results are 'interesting'.

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

#182

Earlier quoted context omitted.

To the naysayers: these languages are either compiled, or will be JIT'ed at runtime. What they will be compiled to will be chip specific binaries-- x86, ARM, whatever. The energy usage will be markedly different depending on which chip architecture is chosen, and will no doubt be inconsistent between different architectures and languages. Or to put it another way. Why do you think mobile devices almost exclusively us…

With regard to datacenter operators, I would argue that a simpler answer to that observation is that they are investing heavily in the are in which they can actually effect change. That is, they can swap in-and-out their hardware, but language of choice is largely up to their customers - the dev. They can advocate and champion a particular language, but really enforcing it in any meaningful way is narrow casting thei…

They could offer their own compilers or runtimes. Some big companies do. But most dollars and time is spent on hardware R&D and upgrades.

Facebook and Google both have in house chip designers these days, specifically for their data centers.

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

#184
post #69

Earlier quoted context omitted.

Seeing to the amount of transactions running over cobol it might deserve a place in a list like this.

If you're still using COBOL, power usage is likely very low on your list of concerns

No? Just about any financial transaction, insurance calculation and a lot of telcos operations run mainly of cobol.

Something like 90% of all credit card transactions.

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

#185
post #101

This 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…

How do you think, would the orders of languages (as listed in different tables in the article) change, if we repicated this study using other CPU?

It is not about stack rank. Your measurements in joules is going to be affected by another variable which was omitted in your experiments! This type of omission would be pretty obvious spot in a scientific paper citing lab experiments.

You will see different energy outputs per language based on their compiled results depending on chipset architecture. And you will see different deltas between them; e.g. language x may use 10% more energy than language y on chipset A, but use 20% more energy on chipset B. And usage will vary depending on which kind of task is performed on which chip architecture, and with what language.

So you did a poor job setting your controls. The effect of the programming language was not well isolated in your benchmark trials, so setting chosen language as an independent variable is flawed. Who knows whether the overall ranking of languages would be affected had the benchmarks been done differently.

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

#186

Can't run Rust without powering the HN servers, to host the screeds of its acolytes. I jest, (and I'm a Rust admirer myself), but my more serious point is: so many different kinds of electricity go into a plush tech company with its well paid developers and our copious brain food that powers us through all our developing and debugging. If you want to talk about sustainability, ask about the lifecycle maintenance of a…

Scala is a nice sweet spot. Good type system, solid for refactoring, good for expressing algorithms. You burn tons of CPU compiling but that’s one dev footprint.

Anyone from Twitter care to comment on this?

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

#188

Earlier quoted context omitted.

as not all languages get the same attention. ...which also seems to be reflective of how much programmers using language X care about (execution) efficiency, so I'd say these results are not far off from reality. C and C++ are another interesting pair --- proponents of the latter always love to claim "zero cost abstractions" that allow you to write very abstract code which they say the compiler can then optimise (or…

I think it calls into question the code samples. There are very few C features not in C++.

I haven't seen the code, but maybe c&p-ing the C entrant into the C++ box to get performance parity would make the C++ entrant run afoul of typical C++ coding conventions.

(You can then have a debate about whether you want to see idiomatic C++ in benchmarks or purely the most performant C++ possible. Personally if I'm shopping for a language for a project then I'm far more likely to be interested in the former.)

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

#189
post #141

Earlier quoted context omitted.

Any articles/resources on writing high-performance JS that you would recommend? I don't use JS for work, but just for random fun stuff. So just curious to learn more about it.

Check out gl-matrix.js, that’s one designed for being fast. It’s a simple math library, but the main way it achieves fast is by not allocating memory. After having worked on JS for some large web apps that need good graphics performance, the two rules of thumb in my head for making JS fast are: 1- avoid dynamic memory allocation, and 2- avoid using the functional primitives like map. The first one is more or less tru…

> 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

Post reply on HN