6 ms·
The greenest instruction is the one you don't run in the first place. Remember that the next time your reason to be lazy about perf optimization is "just throw
by finnthehuman 6y ago
The greenest instruction is the one you don't run in the first place. Remember that the next time your reason to be lazy about perf optimization is "just throw more hardware at it."
- jeffbee 6y agoIt's not linear like that. If the machine is on and the core is running you can dispatch instructions into it at zero cost.
- abstractbarista 6y agoIs that true? I thought cores slept until they were needed. Or didn't clock as high if instruction load wasn't there to match. There is of course always some nominal minimum power consumption for a server to be on. But every instruction requires some additional amount of electron flow to execute.
- WrtCdEvrydy 6y agoDatacenter grade stuff won't sleep as conservatively as a desktop grade CPU.
- lucb1e 6y agoYou can configure it to do that, though. I don't run my hardware in a datacenter (I prefer hosting from home for various reasons) but my server's CPU is set to use the powersave governor.
- jeffbee 6y agoLet me put it a different way. There may exist two different programs that draw the same amount of power through the CPU but have different instructions-per-clock performance. The one with the higher IPC is getting all its extra instructions for free in energy terms. Look at it another way: if a machine is already in its highest power state, with all cores running, but only executing one thread per core, running another thread on each core may cost almost nothing in terms of energy but could boost instructions retired by a lot. The marginal cost of each instruction in compressed at the high end of utilization. The first instruction costs a lot, but after you're already running it the best thing you can do for efficiency is take utilization on that machine straight to 100%.
- derision 6y agoThat's not true is it? Most modern CPUs dynamically scale in response to load, and pull more or less power to do that.
- adrianN 6y agoIt's approximately linear if you run at sufficient scale, because you save whole machines.
- progval 6y agoBut if you have less intructions to run, you won't turn the machine on in the first place. And even if the machine is already on, giving it instructions to run will make it change the CPU frequency (DVFS), access the RAM, etc. which does increase its power usage.
- jeffbee 6y ago"access the RAM" is a big one that people overlook. Yes it might cost a few picojoules to load a line into cache, but the major cost of RAM is just that it exists and there is no low-power mode for refreshing it. RAM is incompressible and statically provisioned so if you can use memory more efficiently you can just buy less and this will save you a lot of power 24x7.
- speedgoose 6y agoYou need more developers if you want more optimized source code. Developers emit a lot of CO2.
- gpm 6y agoDoes using more developers emit more CO2? Or is the number of people in fixed supply with close to fixed CO2 output and more optimized source code just means less source code, or more people optimizing source code and less people working in the hardware supply chain, or something else along those lines. Edit: To be clear, this is a real question. I've been mentally debating for quite awhile whether or not I should allocate workers CO2 output to companies or not.
- speedgoose 6y agoIt's an interesting question. Perhaps if you use fewer developers, a few humans will have another professional occupation which may reduce their income, and their CO2, or perhaps hiring more developers to do unnecessary tasks prevent a few humans to have jobs that produce more CO2. I feel like it's very difficult to model. I also think that workers should be responsible for the CO2. Because otherwise, who is responsible?