10 ms·
Even if those additional MB/s are not critical for any particular application, tools like these are ran a humongous amount of times every day throughout the wor
by Al-Khwarizmi 4y ago
Even if those additional MB/s are not critical for any particular application, tools like these are ran a humongous amount of times every day throughout the world, so while I have no data, I suppose the total CPU usage could be enough that global energy/carbon savings from this kind of optimization would be relevant.
- bipson 4y agoI don't think it works that way. While in general efficient programs can save energy, the "saved" MB/s do not necessarily correlate with saved J. There is no direct cost for a instruction, there is a severe overhead from the machine plainly being switched on. And it's not like you will always be able to "use" that saved MB/s for something else. And you entirely neglect the "cost" of optimizing. Alone the time spent looking at inefficient code probably cost more energy than all the actually saved energy by a single change. Consider the time someone could have spent on something else, with significantly more impact.
- spacemanmatt 4y agoSo much agreed. The computing operations where saving instructions equals saving energy are really few and far between. Or non-existent.
- Al-Khwarizmi 4y agoI'm not an expert on hardware, but I do know that CPU consumption depends on CPU load. A laptop battery drains faster and fans run faster when the CPU is working than when it is idle. More MB/s mean less seconds and therefore more idle time. So how could running a program that has more instructions and takes longer to do the same work not have a cost? About the second part of your comment, it's true that optimizing has a cost, and if I were creating a "yes" or "cat" program for personal use it would obviously be pointless to optimize. But if it's a program ran by millions of people often (probably more true of "cat" than "yes"), it's not that obvious to me that millions of little savings cannot offset the time of one person optimizing.
- citrin_ru 4y agoI never heard about anyone using yes to generate large data files/streams. Does anyone actually uses yes in a way that its daily CPU usage will be bigger than a rounding error? Also very simple FreeBSD implementation [1] is not too slow on my 10-years old notebook: > time yes test_string | dd of=/dev/null bs=1M count=65536 ... 2646329200 bytes transferred in 1.709196 secs (1548288918 bytes/sec) 0.023u 0.850s 0:01.71 50.8% 5+166k 0+0io 0pf+0w Firefox probably have used more CPU time while I was composing this comment - thanks to JS (in other tabs, HN is a rare example of a site which doesn't abuse my CPU). FF is almost always on the 1st line in top. If you'll check top/powertop and a typical desktop or a server you'll likely find better targets than 'yes' to reduce energy use. [1] https://github.com/freebsd/freebsd-src/blob/main/usr.bin/yes/yes.c https://github.com/freebsd/freebsd-src/blob/main/usr.bin/yes...
- deleted 4y ago[deleted]