How Much Energy Does a print("hello world") Really Use? 🔋🔋🔋🔋🔋 Yesterday, Microsoft launched bitnet.cpp, a new library to run small LLMs on CPUs with incredible energy efficiency. This led me down a whole bunch of articles on energy efficiency and I came across a fascinating analysis on the energy consumption of programming languages (arXiv:2410.05460). I was blown away: Python ranks 75x higher in energy use than C! Even more surprising, JavaScript is 18x more efficient than Python! Kudos to the brilliant minds behind the V8 JavaScript engine. 🔥 Side Note: Pascal still beats everything in memory efficiency 😆 #Innovation #GenAI #EnergyEfficiency #LLM #Sustainability #Technology #AIRevolution #Performance
I adhere to most of the comments here. What also needs to be taken into account is the number the software is going to be used in relation to the energy consumption of the human programmer. As an original trained bioinformatician i often created programs to run only once and then yield a result, meaning that the amount of time the programmer spend is also an important factor.
Table 4 above is from a prior (2021) work by Pereira et al, which - as was shown in this recent paper - has significant methodology issues. Otoh this most recent paper (2410.05460) seems limited (by the choice of measurement tools) to Intel CPUs (as per GitHub repo note) while AMD CPUs may behave differently due to a much larger 3rd level cache per core etc and also tests in this recent paper were only run on 1 specific CPU model (Xeon 6430) while at the same time claiming that there's no significant difference in energy consumption between programming languages - which is highly dubious to me (in part due to a very different CPU and RAM usage patterns between programming languages). So it remains an interesting open question. As to Python - there's likely a significant difference in energy usage between CPython and PyPy and (likely even more so) major differences depending on the degree of concurrency (e. g. between using only a few vs most of the available CPU cores - see fig 11a).