Hacker News new | ask | show | jobs
by misja111 1077 days ago
Amazing. I have seen this list popping up in my LinkedIn feed for more than a year already and it keeps coming back.

While any benchmark is of course interesting when considered on its own, the conclusions that people draw from this list tend to be complete nonsense: "Python is bad for the environment", "we should switch to language xxx to combat global warming" etc.

First of all, especially for the slower languages in this list, it is extremely rare that application code written in that language is the bottleneck of a performance critical application. Typically the bottlenecks of every day applications tend to be databases and network. If you need heavy number crunching, there tend to be excellent libraries available written in lower level languages, such as e.g. for Python NumPy and Pandas. If you are really concerned about the energy footprint of your application, you're probably better off with optimizing these components. Or optimizing the higher level architecture of your own application, which tends to be a lot easier in a higher level langguage.

Second, coding in a faster language is often not economically possible. Programming the same application in C will normally take much longer than coding it in Python. Developing time costs money and can also mean loss of opportunity.

And finally, the 'greenest' language of them all was not even included in this list: assembly. I guess the author must have realized in the back of his head that such a difficult language wasn't a realistic option for switching to a more energy efficient solution. He/she just failed to realize that this argument applies to many other languages as well.

4 comments

> "we should switch to language xxx to combat global warming" etc.

These takes fail to take into account the huge discrepancy between the market value produces by computer systems per unit of energy. It is such a huge value that it barely matters compared to most other industries, plus the net amounts are not particularly high either. Nonetheless, it can matter in certain cases, and Java is a great choice for server setups due to its GC being very efficient in doing only the necessary amount of work.

Also, I’m not convinced that a full on complex assembly app would be leaner than the same program written in a lower level language. That’s an area where compilers are very good, and humans only have so much working memory/hair on their head to hand-optimize whole programs.

I would add that proof of work algorithms (Bitcoin type) where the goal is to endlessly compute hashes with no real computational productivity gain are the real offenders, regardless of which language they're written in.
LLM has entered the chat...

Most of the implementations for LLMs runtimes I know of are Python using PyTorch. I believe most of the heavy lifting is written in C++ (llama.cpp), though.

>regardless of which language they're written in.

And given that a major limitation of bitcoin-hashing is the cost of electricity, I would guess that they're written in a very energy-efficient language already.

I think you bring up a good point. Our economic system isn't designed to reward low energy consumption. In fact, GDP and energy usage are very tightly linked. And because we are seeking growth in GDP at a system level, we are doomed to use more energy.
Considering energy costs money, our economic system is literally designed to reward lower energy consumption.
Strange, and yet we keep using more energy every year. Fun fact, we burn as much wood for heating as we did 100 years ago. What ends up happening is we consume all available energy. Economic growth is limited by energy so the whole system is incentivized to GROW energy usage, not reduce it.

I suspect you are talking about per capita energy usage. Per capita energy usage has stayed around 80 mWh per person since 1965 in the US.

But what's important isn't the per-capita usage, but aggregate usage. Because guess what, the climate doesn't care about per-capita CO2.

You have to look at it from a system level, not individual actor level. Our whole political and economic system is designed to have exponential GDP growth. And because energy is a limiting factor in GDP growth, then our whole political and economic system is designed to extract as much energy as possible to keep growth from hitting that limit.

>Fun fact, we burn as much wood for heating as we did 100 years ago. What ends up happening is we consume all available energy. Economic growth is limited by energy so the whole system is incentivized to GROW energy usage, not reduce it.

That's because the population has increased but poverty hasn't substantially decreased, and the poorest people on the planet tend to burn wood for heating instead of using electricity.

> GDP and energy usage are very tightly linked

Correlation or causation?

Side effect.

Energy consumption is a result of labor applied to tools and technology for production. It is not mere correlation, but it is also not the cause, it is one measurable downstream effect.

China, in fact, used energy consumption as the measure for GDP reporting. For this reason, local leadership in cities and provinces would game the system by running the coal plants at peak and turning on all lights in a city day and night to juice the numbers so they'd show higher GDP (Beijing used to do this before they hosted the Olympics, for example).

Available energy is a limiting factor in economic growth. More available energy allows for more economic growth. While a decline in economic growth for other reasons (financial crisis, pandemic) reduces demand for energy. So it's both a cause and effect. It's a feedback loop! Asking it it's causation or correlation is the wrong question. Does the temperature in the room effect the thermostat, or the thermostat effects the temperature in the room? It's a feedback loop!

In other words, when potential economic growth buds up against energy supply, energy prices rise and they rise non-linearly. This causes a reduction in potential economic growth. If there is a decline in economic growth, then demand falls below supply and prices drop. As prices drop they enable more economic growth.

In other words, the economy grows as much as energy supply allows. A 10% decline in available energy means a 10% decline in GDP. It really is that linear.

The link is marketing for some consulting firm.