- using switch kerword properly
Remember that put the most frequently used case branch on the first place of switch-case branches. It helps to reduce time spent on detemining which branch to execute.
- using assembly language for time-critical operations
Replace codes written in C language with assembly language would greatly improve the performance especially when the code is executed frequently. Note that using assembly language may decrease the readability of the code
- using register keyword
Using a register variable tell the compiler to put this variable in the CPU's registers instead of stack. The speed to read variables stored in registers is faster than read variables store in memory.
- Avoid using some standard C library functions
Standard C functions are designed for general use. They must consider all the possibility, this increase the code size(e.g, springf is oversized for some embedded systems). You can write your own standard- C-fuction-like functions, with some features ignored.
for more info, refer to