Optimization

This serie contains a set of entries considering various methods of optimizing software, binary output size optimization, performance optimization or memory usage optimization. Althought the topic is mainly important for embedded software which is characterized by small size of non-volatile storage, RAM memory, battery capacity or other resources, some of described methods can be also successfully applied to all types of software.

Micro-optimizations

Low-level methods to make your embedded code more efficient, or less efficient, if done unnecessarily. The effects of such tricks are strongly dependant on the compiler and target machine. Always check the specific case before changing code!

Useful resources

Online interactive C++ compiler, presenting the output assembler code. You can play with various compiler options and code structure and watch assembler changes on the fly. https://gcc.godbolt.org/

performance optimization

  1. Improve performance with cache prefetching
  2. Loop unrolling

Binary size optimization

  1. Cross jumping/tail merging

MEMORY USAGE optimization

  1. Storing sparse matrix – list of lists LIL
  2. Struct members order does make a difference

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s