jonblack / arduino-menusystem

Arduino library for implementing a menu system
MIT License
194 stars 85 forks source link

Move implementation to header file #62

Closed jonblack closed 7 years ago

jonblack commented 7 years ago

I noticed that by moving NumericMenuItem::get_xxx to the cpp file it increased the binary by ~120 bytes. This means that space can be saved by putting implementation in the header file. First I want to understand why this happens.

jonblack commented 7 years ago

Putting the implementation can make it easier for the compiler to make optimizations. Putting a reasonable amount in the header file caused the serial_nav example (which uses all component types) to reduce by 0.4% (~132 bytes). Examples that use less component types have a smaller saving. For now this doesn't seem worth it so I'm closing as dontfix.