[En-Nut-Discussion] Code Optimization

Moritz Struebe morty at gmx.net
Mon Mar 3 12:39:54 CET 2008


Hi there,

during my development I noticed that using const and __attribute__ 
((const)) in function declarations can speed up the code and reduce it's 
size quite a bit. This is mainly due to compiler optimizations. I 
noticed that these const declarations are used quite sparingly in the 
code. Is there a reason for this?

I'd also suggest changing functions like EEPROM_WRITE into "extern 
inline" or "static inline" (probably "extern inline" is more 
reasonable). This makes the code more easy to debug using O0, gives you 
better compiler warnings and has no disadvantage as soon as you use O1.

Comments welcome! :-)

Cheers
Morty



More information about the En-Nut-Discussion mailing list