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…
Which Programming Languages Use the Least Electricity? (2018)
121–130 of 267 posts
Re: Which Programming Languages Use the Least Electricity? (2018)
#122I always feel like there is a big misunderstanding of what it means to “write a program in some language” in these types of comparisons. For example, saying that Python uses much more energy is a foolish thing to say. The “same” algorithm written in pure Python is a very semantically different thing. It involves allocation of flexible objects that obey certain attribute lookup protocols, operator protocols, dynamic a…
Re: Which Programming Languages Use the Least Electricity? (2018)
#123I'm a little surprised at where Erlang features in the list. I've never used it personally, but have heard so much about it being an amazing, performant language. I wonder why it's so time/energy/memory inefficient for the algorithms used in this exercise.
BEAM has a 'busy wait' feature. Schedulers with no jobs to do will remain active so they can respond to new jobs faster. You can turn this down so that the schedulers go to sleep quicker, reducing CPU usage. From http://erlang.org/doc/man/erl.html : +sbwt none|very_short|short|medium|long|very_long Sets scheduler busy wait threshold. Defaults to medium. The threshold determines how long schedulers are to busy wait wh…
Re: Which Programming Languages Use the Least Electricity? (2018)
#124Couple 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…
Two completely serious questions here, 1 - Why would you want to replace java on the server? (Seems obvious that it provides the best balance of productivity and performance per watt.) 2 - Assuming a company would want to replace jave, why, on earth, would we not use C++? (Or, perhaps, rust if we want to use a newcomer?) Why are we better off going all the way down this list to go and swift?
Well one reason, if you look at the paper, is memory consumption. One of the ways Java gets good performance despite being a GC'd language is less efficient memory usage. (Although there are many advancements in this area akin to what Go has accomplished but as the paper's metrics show, often Java uses a lot of mem.)
Also probably lots of people will agree that it has accumulated some cruft over the years and predates lots of modern trends and things like concurrency and functional programming and whatnot require more complicated code patterns.. a classic example is the getter/setter verbosity of a simple value type (not trying to start a flame war here).
However it's fair to say Java is the thing to beat in terms of "goldilocks" languages that blend productivity/safety with performance.
> 2 - ...would we not use C++?
Because it's a huge regression in productivity and safety. The goal is to reduce memory consumption while achieving great performance and, crucially, consistently low latency which is a greatly underappreciated server metric and really should be the number one benchmark IMHO.
Re: Which Programming Languages Use the Least Electricity? (2018)
#125Couple 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…
> Swift That's a pretty cool idea. I read something on HN the other day about using swift in the back end, but haven't used it myself. Hopefully Apple gets support for non-ubuntu linuxes as well as windows out the door (especially since they're no longer making their own hardware). I've heard anecdotally that it has very slow compile times, so that might be another issue. > Swift is unique in the server world in that…
My guess is you fall into one of two categories:
1- You don't care a ton about efficiency because you can scale out to infinite servers that are relatively cheap and affordable. So you can run on django or rails or whatever and it's fine at "pre-IPO" scale.
2- You do care, but Java is good enough.
So you kind of have to be at Google's scale to care about creating a new server language. In Swift's case, the motivation was super constrained mobile devices, so bringing it to the server side is more of an incremental engineering cost against that massive investment.
Re: Which Programming Languages Use the Least Electricity? (2018)
#126How does "TypeScript" come out to an energy score of 21.50 when "JavaScript" has a score of 4.45 - that makes 0 sense.
Re: Which Programming Languages Use the Least Electricity? (2018)
#127Couple 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…
Not sure why you picked on Java though. As per this study, Java is doing better than both of them. So at least if the goal is to improve on those, you need to look at Rust/C++/C/Ada.
Re: Which Programming Languages Use the Least Electricity? (2018)
#128I'm a little surprised at where Erlang features in the list. I've never used it personally, but have heard so much about it being an amazing, performant language. I wonder why it's so time/energy/memory inefficient for the algorithms used in this exercise.
Erlang's use case is handling lots of connections simultaneously, and messaging between processes. These benchmarks are all single-threaded, pure computation. Erlang is pretty slow at that (alas).
For being a mostly pure functional language it performs pretty well in that category. To the parent comment’s question, the reputation for solid performance likely comes from Ruby/Python developers. When dealing with web server applications it really shines due to how it handles concurrency. Also NIFs are really easy to write, especially in Rust.
Re: Which Programming Languages Use the Least Electricity? (2018)
#129Are they counting the electricity used to heat the pizzas that feed the programmers?
This was said half in jest I suspect, but it's not a completely off the wall concern. For an infrequently used program the energy burned in its development could easily be a nontrivial amount of the total energy used over its lifetime. If you can write a 5 line Perl script that gets the job done (and is only run a couple dozen times ever), then you're probably saving energy over the 100 line C program despite the mas…
Re: Which Programming Languages Use the Least Electricity? (2018)
#130Couple 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…
How do you get the 11 years figure? What is your idea of a drastic reduction? How will you measure it? And should all countries observe it equally?
[1] https://en.wikipedia.org/wiki/Intergovernmental_Panel_on_Cli...