91 points · by gdrift · 5y ago · 127 comments
To give a data point, in 2021-era C++ it's approximately 3 years with a very large part of it being done by a single person (https://github.com/SerenityOS/serenity). How long would that take with python ?
That almost sounds like confusing goals with ways to me. Unless those very specific ways are your goal for some reason, if you were to "build a decent and snappy GUI operating system from scratch", you probably wouldn't end up with those things in it. You'd end up with something more similar to Oberon, Smalltalk, or VPRI's system (was it Frank or something like that?).
(These days no OS is going to succeed with end users if it doesn’t have a browser).
Why would that be interesting? They'd exist and consume the same amount of energy regardless of what they worked on...
But that said, the overhead of the engineers energy consumption is overhead that probably turns to nothing over the life of a successful project.
I really don't understand. They'd just work somewhere else and consume energy, housing and food. There'd be literally no difference.
We are in the midst of a serious crisis, we know the reasonable solutions we should be taking to avoid catastrophe, and we are collectively choosing to ignore them. It should be treated seriously. If we're going to joke about it, it should be dark comedy.
Can you create a web framework in C that has as many features as Rails or Django? And what's the power consumption of that?
Higher level languages do more stuff. It's not like Guido and Matz just woke up one day and were like "fuck your CPU".
Plus, compilation requires a decent amount of power, as shown in those graphs. Does every C/C++ project run perfectly with no bugs the first time?
Still curious what the power savings are... I'm sure they've done enough profiling to know their performance is increasing. But are they saving energy? How about the compilation cycles to get to where they are? The carbon footprint of the additional employees? Etc...?
When the code will be deployed on 10K-1M machines, compilation costs are noise. In fact, FB does all sorts of expensive optimizations to ensure that the deployed executables are as efficient as possible, and the effort is worth it many times over. I'm sure the same is true at Google and elsewhere.
Some napkin carbon footprint math—a computer on for eight hours daily does ~200 kg of CO2 in a given year. An average human on the planet is doing ~7,000 kg. Which means the average human’s 8-hour workday is ~6.4 kg CO2.
Yeah, let’s pull out the abacus and the slide rule while we’re at it, in the interest of carbon footprints. /s
https://towardsdatascience.com/high-performance-code-pays-di...
"The climate crisis threatens human civilization on a grand scale and electricity is frequently produced from fossil fuel. Electricity is then consumed by the operation of computer code. Google alone used 12.8 Terrawatt-hours in 2019 according to its 2020 environmental report, more than many countries and more than several US states. It seems intuitive that improving code efficiency should reduce environmental impact. Does it?
The answer is not at all clear and must be considered on a system by system basis. The main reason is induced demand.
...it will take a centrally coordinated process at both national and international levels that can allocate energy to different industrial and consumer sectors and manage the energy production mix on behalf of the whole of society. Only then we can solve this problem in a rational way that doesn’t depend on luck.
In fairness, software companies aren’t power companies, it’s a little ridiculous to expect them to build their own generation. What we can more expect from them is to pay taxes, divest from fossil fuel companies if they hold securities, and hold their total energy consumption under a ceiling set by a regulator while the society changes the energy mix as fast as possible."
Different languages were made with a reason, and they solve different problems. Even Python can be efficient when your largest bottleneck is network or disk IO.
Nowadays we have Rust, which is slowly catching up to C speed, and sometimes even surpasses it.
C is a beautiful language when used in embedded space, where memory allocations are minimal. Once you start throwing mallocs left and right, you lose that simple elegance.
From that paper, only C and Pascal, are optimal for energy and memory usage.
And Pascal has memory safe strings with reference counting. C is just too unsafe. 70% of all security issues are caused by C.
C or any "so called" efficient languages are wonderful for their use cases. Python or Erlang have other use cases. We have all of those languages for a reason.
Anyway you can take my Erlang from my cold, dead hands.
Now I have proof it wasn't.
Thanks, C++.
That includes defects,
It's one of many reasons I like new compiled/vm languages like Go, Swift, Nim F#. You got the productivity of python, but near the performance of C. User wins, dev wins and planet wins.
From the best analysis it does seem modern c++ could be the optimal performance/energy/speed/safety choice.
And yes I'm a proud c/c++ programmer.
That stab is mostly aimed in the direction of C# and Java
one could argue, that programming languages that are more close to the mind are more efficient. At least when looking at 2nd to n-th order efficiency effects, not just pure runtime performance.
Could it have been even better in C? Probably, but it was a lot easier to conceptualize and properly choose the architectural features that made the difference using ruby.
These days I would have done the rewrite in golang, and had the best of both worlds.
Could we get something as flexible and expressive and ergonomic as React or Vue with the performance of WASM?
2) There is a gopher proxy for HN: gopher://gopherddit.com
3) Use CLI tools, avoid JS ridden apps. If so, download the video and use mpv offline. Many times less power wasting.
And honestly, that would be an improvement. The trend seems to be to write more and more applications in JavaScript with Electron [1], which I unrigorously assume uses 10 to 100 times the memory and CPU of an equivalent Python app (given Electron apps seem to most frequently make my fan spin or have some kind of memory leak requiring a force-kill).
[1] Now ranking higher on Google than the subatomic particle: https://www.google.com/search?q=electron (https://archive.ph/J2HYI)
I have no idea about memory consumption. I assume Python does better than Javascript there due to reference counting.
I suspect that Electron apps are so easy to create and run somewhat acceptably, that the trend is for the developer to add more bloat than would otherwise be there. So a very efficient runtime leads to developer laziness.
Well, that's how you judge a language. You write code in it, as opposed to writing it in some different language not under consideration.
But a much worse problem seems to be the fact that binary-trees is not much of a representative benchmark. It's mostly a benchmark of your memory management. Unless your programs spend 80% of their time managing memory, they'll probably not match the results of binary-trees.
With the exception of shell languages (and its overstated even there), the description “scripting language” is usually wrong and at extremely deceptively reductive, even for languages where that was a motivating or at least early major use case.
> their energy savings come from the fact that the programmer is typically the only person who will be running it,
Even when languages are used for scripting, that's not true.
The Python (programming language) is. Ok, if you want to get pedantic you can talk about the language vs interpreter vs ecosystem? I'm not sure what you are getting at.
> It powers many many websites including Youtube. It's a full power limitless language.
Lots of things "power" Youtube. I'm not sure how that's important to point out.
Unless you want to do something crazy like run 2 threads at the same time
And this was such a scalability problem that Youtube decided to spend the unimaginable amount of pain and suffering to rewrite in C++.
Ethereum was released in 2015. The first PoS cryptocurrency (Peercoin) was released in 2012.
2. The specs for the transition are ready and it’ll happen next year. Target is before June. First long-lived Merge testnet goes live next month.
But this won't last. Many energy sources and metals are peaking and I can imagine a day when efficiency will count heavily.