|
|
Rockbox mail archiveSubject: Re: time to sleep?From: Paul Suade (paul.suade_at_laposte.net) Date: 2002-08-24
----- Original Message -----
> 1. Write very efficient code. Every cycle wasted in vain is power wasted!
algorithmic speaking ?
> 2. Do not access memory if not needed. Memory accesses actually take a lot
"register" is no use with gcc since itself will try to put the first local
> * Use the "restrict" keyword whenever possible. This keyword was just
exactly, it is now part of ANSI C like bool is too.
> * Use the "const" keyword whenever possible.
and a good practice : you know if you are right to modify the content.
> * Don't count on the compiler doing obvious optimizations for you. The
The only bemol is that you need to be a good assembly programmer too ;).
> 3. Never busy wait for a long time. Use interrupts or go to sleep.
Obviously.
> 4. Never use interrupts for short timeouts. If you know the timeout is
And much more simple to program too. In fact, using a timer interrupt to
> 5. Don't touch IO chips if can avoid it. The busdrivers often consume a
In short, simply toggle i/o bit when necessary.
Well, I suppose it is not an evidence for all people, especially for those
Page was last modified "Jan 10 2012" The Rockbox Crew |