chdk


Don't optimize prematurely

Consider what overall impact the execution of your code will have. There's no point in saving a few instructions if you are going to spend several seconds reading/writing flash memory. If your code will only be executed when the user is changes a setting in a menu, a few instructions more or less will make no difference.

Optimize for size unless you really need speed

CHDK operates in very limited memory. This means that limiting the compiled code and static data sizes is frequently more important than execution speed.

See CHDK Coding Guidelines for general recommendations regarding memory use.

Optimizing for speed

What follows are general guidelines. If you optimize, you should always verify your optimization with actual testing. If you are trying to optimize C code, check the assembler output.

TODO EXAMPLE
TODO MORE DETAIL

TODO HOW GOOD IS GCC ABOUT DOING THE THINGS MENTIONED ABOVE FOR YOU

TODO ADD SOME LINKS TO GENERAL ARM OPTIMIZATION INFORMATION

Profile Guided Selection of ARM and Thumb Instructions -- Also a good introduction to profiling techniques t