Live data from Hacker News

Which Programming Languages Use the Least Electricity? (2018)

thenewstack.io

261–267 of 267 posts

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

#261
post #259
post #254

Earlier quoted context omitted.

What do the archived pages have to do with this study? The study starts with a snapshot of benchmark game sources. That's a perfectly sensible way to get a bunch of implementations to bootstrap the study. But some of those implementations might be unsuitable for the study, just as (at least) one was, in their case. They don't seem to have noticed that. What's a good, benign explanation that they didn't?

> But some of those implementations might be unsuitable for the study, just as (at least) one was, in their case. Unsuitable because?

Because it's a different implementation that happens to be 15 times slower than the implementation used in the straight JS version. That's fine for the benchmark game, it's a garbage input to a 'how energy efficient are these languages' study.

Let's say I want to measure the 'energy efficiency' of x86 assembly and JS. I'll use sorting an array of 1000 integers. In my JS implementation, I call Array.sort. In my x86 implementation, I randomly shuffle the array and check if it's sorted, if not repeat until it is. Does measuring the execution times of these tell me anything about the 'energy efficiency' of Javascript vs x86 assembly?

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

#262

Earlier quoted context omitted.

What's interesting is also how go and python interaction is since you seem to be able to call go from python and the reverse very efficiently.

Sorry but we actually cheated on that part. Redid the page so that the function that is now in Go is a separate little service that is called via ajax directly by the users' browsers. So there's no actual Python-Go interaction in our code. This was quicker, cleaner and has made the page more responsive for users.

Thanks this comment is useful, client side integration is integration after all, and I think if it was simple, you would have it done differently (if I understand your words correctly - "cheating").

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

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

Thank you for the explanation

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

#264
post #261
post #259

Earlier quoted context omitted.

> But some of those implementations might be unsuitable for the study, just as (at least) one was, in their case. Unsuitable because?

Because it's a different implementation that happens to be 15 times slower than the implementation used in the straight JS version. That's fine for the benchmark game, it's a garbage input to a 'how energy efficient are these languages' study. Let's say I want to measure the 'energy efficiency' of x86 assembly and JS. I'll use sorting an array of 1000 integers. In my JS implementation, I call Array.sort. In my x86 im…

> a different implementation that happens to be 15 times slower

A few TypeScript versions later, that happens to be only 1.6 times slower.

There are good questions to ask about how to handle possible outliers in a study that takes a snapshot of a changing situation and then seeks to make more general claims.

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

#265
post #264
post #261

Earlier quoted context omitted.

Because it's a different implementation that happens to be 15 times slower than the implementation used in the straight JS version. That's fine for the benchmark game, it's a garbage input to a 'how energy efficient are these languages' study. Let's say I want to measure the 'energy efficiency' of x86 assembly and JS. I'll use sorting an array of 1000 integers. In my JS implementation, I call Array.sort. In my x86 im…

> a different implementation that happens to be 15 times slower A few TypeScript versions later, that happens to be only 1.6 times slower. There are good questions to ask about how to handle possible outliers in a study that takes a snapshot of a changing situation and then seeks to make more general claims.

It doesn't matter what happened in the benchmark game later, it's not a study about the benchmark game. It's not 'good questions', it's a huge fuckup by the authors of the study. You're simply wrong to keep saying otherwise.

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

#266
post #265
post #264

Earlier quoted context omitted.

> a different implementation that happens to be 15 times slower A few TypeScript versions later, that happens to be only 1.6 times slower. There are good questions to ask about how to handle possible outliers in a study that takes a snapshot of a changing situation and then seeks to make more general claims.

It doesn't matter what happened in the benchmark game later, it's not a study about the benchmark game. It's not 'good questions', it's a huge fuckup by the authors of the study. You're simply wrong to keep saying otherwise.

Supposedly you are right and others are wrong, which doesn't leave much to be discussed.
Post reply on HN