
Rough idling - ingve
http://www.tedunangst.com/flak/post/rough-idling
======
caf
On Linux, the "powertop" utility will show you processes that are waking up
regularly (such processes can cost you battery life on a laptop or phone by
preventing the CPU entering and maintaining low power idle states).

------
Animats
Back around 2004, when I was using QNX for our DARPA Grand Challenge vehicle,
I discovered that the machines on the vehicle were about 20-30% loaded when
idle. Although they had no keyboards or displays, the embedded CPU boards we
were using did have a minimal VGA controller. We were using the default QNX
install, which has the full desktop environment, and it was bringing up a
screen saver. The minimal VGA controller ran the screen saver very slowly,
because the screen saver was reading from the display memory to scroll, a very
slow process.

All this was at low priority, so it didn't affect the real time tasks at all.
So it wasn't hurting anything. The QNX people were quite embarrassed when we
reported this, though.

------
ansible
I would speculate that even if hardware progress were to stop today, we would
still see advancement in the speed of computer systems for quite some time.
All just from optimizing what we are already doing, or (as others have pointed
out) not doing unnecessary things.

There are so many things I'd like to fix if I had the time...

~~~
cperciva
You're clearly an optimist. I find that the tendency is for software to get
slower -- and generally worse -- over time.

Five years ago I was using Chrome and it was fast, lightweight, and stable.
Now it's slow, uses 500 MB of RAM, and the renderer crashes on a regular
basis.

~~~
idlewords
I think there may be a counterintuitive situation where incremental
improvement in hardware is worse than no improvement.

Consider how much extra performance game developers are able to wring out of a
console after a few years' experience. If the hardware is absolutely stable,
and there's no expectation that it can get faster, then people do make a big
effort on software.

~~~
userbinator
The biggest example of this is the demoscene, where some absolutely astounding
things have been done with old hardware; e.g. a Commodore 64, 1MHz 8-bit CPU
with 64KB of RAM.

------
DArcMattr
And here's some discussion on making OpenBSD's sleep more efficient (starting
with a proposed patch from tedu): [http://marc.info/?l=openbsd-
tech&m=144280057027331&w=2](http://marc.info/?l=openbsd-
tech&m=144280057027331&w=2)

------
peterwwillis
On very fast local systems and networks, 'rough idling' can go on for a very
long time, until it comes time to scale.

One time I found the cause of a program that was run at regular intervals and
was taking a few minutes to complete running. It would run approximately
42,000 SQL select calls every time it dropped into a new directory to parse
some files. It only took 10 minutes to process the entire directory structure.
So the program was actually incredibly fast, considering all the work it was
doing.

The catch? It only needed to run SQL select 42 times per directory; the other
41,958 calls were not necessary. As far as I know it was never fixed, because
it only took 10 minutes to run.

~~~
spydum
this reminds me of
[http://accidentallyquadratic.tumblr.com/](http://accidentallyquadratic.tumblr.com/)

------
w8rbt
Reminds me of the best optimization advice I ever got, "If you want to go
faster, do less."

~~~
bitbckt
No code is faster than no code.

~~~
agumonkey
Very nice self referential quote. Who coined it ?

ps: LMGTFM
[https://en.wikipedia.org/wiki/Kevlin_Henney](https://en.wikipedia.org/wiki/Kevlin_Henney)

------
vezzy-fnord
Related, a famous example of how "doing nothing" can be a surprisingly
difficult problem:
[https://en.wikipedia.org/wiki/IEFBR14](https://en.wikipedia.org/wiki/IEFBR14)

~~~
bch
Your example doesn't obviously support this, but reminded me of Mark Twain's

"I didn't have time to write a short letter, so I wrote a long one instead."

~~~
vezzy-fnord
Actually Blaise Pascal's, from Provincial Letters XVI.

------
hackuser
Does anyone know under what circumstances changes to software can
significantly impact energy consumption? I'm thinking of this from the
perspective of the environment and of impacting climate change. How often is
that considered, outside of mobile platforms? What are the largest
opportunities, if there are any big ones?

For example, TCP is so widely used and affects so many machines with each
transaction (i.e., the endpoints and everything in between) that I'd guess
that a tiny increase could make a large impact globally. Or there might be
other software where there's an opportunity for a large improvement.

~~~
13thLetter
I was immediately skeptical, but then I looked around and found some articles
claiming that as of 2013 computing in general accounted for fully ten percent
of global electricity usage. So maybe we should be putting some thought into
this issue after all.

~~~
jerf
It should be pointed out that we do in many places. Mobile has significant
incentive to be efficient. Cloud has significant incentive to be efficient.
Mobile efficiency creeps into a lot of other home tech because it's cheap to
use that highly-scaled mobile technology now, because it's off-the-shelf. The
worst is probably stuff headed for the home that is too big to use SOCs, like
desktops and game consoles. But it's not as if the entire industry is
oblivious to this issue... Performance-per-watt is an already-important
metric, and it will only get more important.

[https://en.wikipedia.org/wiki/Performance_per_watt](https://en.wikipedia.org/wiki/Performance_per_watt)

~~~
Narishma
Consoles do use SoCs, mainly because they're cheaper than discrete processors.
At least the current ones do. They're just not mobile SoCs.

------
throwaway2048
Be sure to check out the powertop tool, it can be very useful in measuring how
often something is waking up the processor when it should be idle.

------
wfn
What's the language at the bottom of the post, the one that is able to
allocate custom `structs` and has some OOP stuff in it?

~~~
JdeBP
That's Lua, with LuaJIT FFI and the ljsyscall library.

* [http://luajit.org/extensions.html](http://luajit.org/extensions.html)

* [http://myriabit.com/ljsyscall/](http://myriabit.com/ljsyscall/)

~~~
wfn
Very neat. Thanks for the info!

------
TazeTSchnitzel
Since OS X Mavericks, Apple's been cracking down on programs that wake up the
CPU too much. Thus the infamous hall of shame in the battery status menu.

