Live data from Hacker News

Which Programming Languages Use the Least Electricity? (2018)

thenewstack.io

171–180 of 267 posts

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

#171
post #91

Couple points (I've worked on app servers): 1- This is exactly how we should all be thinking about server engineering moving forward, as we aim to drastically reduce carbon footprint within 11 years. Efficiencies at the language level are one of biggest bangs for buck here. Just by redeploying, you can reduce energy consumption by perhaps double digits. Imagine how hard that is to do at the hardware or energy farm le…

I don't think carbon footprint is the be-all end-all you suggest. In a startup that has yet to scale, trading off efficiency for, say, flexibility, safety, or expressiveness may have minimal carbon impact but major benefit for your business. After all, few here will defend the choice of C for web service development these days.

I think 'safety' is the key term here. In the future we will see more self-driving cars and other self-... machines. I would like them to provably not crash (into me).

If it were up to me, no matter the energy consumption, a piece of software in that realm should be proven correct (both crash-free and doing what the specification says).

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

#172
Historically, virtually every move up the abstraction level sacrificed performance to gain programming efficiency. Assembly to C, C to C++, C++ to Java, Java to Python/Javascript. And now there are wars over Javascript vs. Typescript, and jQuery vs. React/Angular. Every new step up the stack claims that the higher level of abstraction can either be implemented with only a minimal penalty, or could actually improve performance due to easier automated optimization. However, every time, it seems that in practical applications, performance is sacrificed to make software development faster.

I don't know enough about the performance of Javascript vs. Typescript to form a strong opinion about it, but if history is any guide, it's likely that it improves software development efficiency at the expense of performance.

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

#173

Historically, virtually every move up the abstraction level sacrificed performance to gain programming efficiency. Assembly to C, C to C++, C++ to Java, Java to Python/Javascript. And now there are wars over Javascript vs. Typescript, and jQuery vs. React/Angular. Every new step up the stack claims that the higher level of abstraction can either be implemented with only a minimal penalty, or could actually improve pe…

I mean, JavaScript comes out 4.5x slower and consuming 6.5x more memory. For TypeScript the numbers are 22x and 46x respectively. That honestly makes me very suspicious about the benchmark set-up.

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

#174

I did not expect Lua to be that far down the list. I thought Lua was a go to choice for scripting embedded software. Also, I'm not surprised that JavaScript outperforms most of the other scripting languages (according to this potentially erroneous benchmark).

I also was disappointed that my favourite language did so poorly in these tests - I wonder, though, what the stats would have been like had LuaJIT been factored in. Perhaps something for future evaluation ..

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

#175

Historically, virtually every move up the abstraction level sacrificed performance to gain programming efficiency. Assembly to C, C to C++, C++ to Java, Java to Python/Javascript. And now there are wars over Javascript vs. Typescript, and jQuery vs. React/Angular. Every new step up the stack claims that the higher level of abstraction can either be implemented with only a minimal penalty, or could actually improve pe…

Typescript usually transpiles to javascript, just without the type information, and this is not done in the browser. If you target old browsers it can add maybe add some overhead like babel does.

I don't know about javascript's usual JIT compilers, but LuaJIT's JIT compiler (trace compiler) does a pretty good job of figuring out abstractions.

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

#176

Earlier quoted context omitted.

This is like arguing that the science behind vaccines is invalid because doctors can’t predict when you’re going to catch your next cold. It’s willfully obtuse and has no place on HN.

Climatology is not science. There is no falsifying experiment.

More anti-science nonsense. Here, let's let NASA tell you the definition of the scientific method.[1]

[1] https://climate.nasa.gov/news/2743/the-scientific-method-and...

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

#177
post #4

Interesting results, but I think the farther you go down the list the more the fact that you're using the Computer Language Benchmark Game affects what you're seeing, as not all languages get the same attention. For example, Javascript and Typescript. Theoretically, I would assume those to be very close, since one compiles to the other. And for memory usage, they are very close. But for running time, Typescript is an…

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++.

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

#178

Earlier quoted context omitted.

Typescript is a superset of Javascript, you can literally submit the faster JS programmes as the TS ones.

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.

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

#179
post #55

Earlier quoted context omitted.

I'd be very interested in seeing a few energy benchmarks not here, for example: energy to route 1B hits to a web endpoint, energy to parse a Json, energy to grab an auth token from a web request and forward to an auth server. Energy to forward 1M 1k files from the filesystem to the network, etc.

Well, I think the reason they don't do that, and focused on the benchmark game (which I think is a good solution to their problem of needing representative sample, it just comes with its own caveats), is because much of that is often handled by libraries (possible written in C), code in the Interpreter or VM (also possibly written in C), or handled by the OS (in the case of connection handling and file access). Those…

The language and the runtime are basically one package. I don’t care that node is fast because it is all C under the hood. To the end user, it’s just fast.

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

#180
post #66

Reversible computing should be mentioned, as it could be the holy grail of low energy use. https://spectrum.ieee.org/computing/hardware/the-future-of-c...

Almost 20 years ago I took courses under a professor who was very into reversible computation. As I recall it was mainly on the language side, though.

Glad that it's still moving, sad that it's at an even slower pace than the "functional/immutable will save the parallellization worries" stuff I encountered in the same period.

Post reply on HN