free hosting   image hosting   hosting reseller   online album   e-shop   famous people 
Free Website Templates
Free Installer

Writing Efficient C & Code Optimization

Introduction



Where it needs?



Integers



Division and Remainder



Combining division and remainder



Division and remainder by powers of two



An alternative for modulo arithmetic



Using array indices



Global variables



Using Aliases



Live variables and spilling



Variable Types



Local variables



Pointers



Pointer chains



Conditional Execution



Boolean Expressions & Range checking



Boolean Expressions & Compares with zero



Lazy Evaluation Exploitation



switch() instead of if...else...



Binary Breakdown



Compare between tow Case statements



switch() instead of if...else...



Switch statement vs. lookup tables



Loops



Loop termination



Faster for() loops



Loop jamming



Function Looping



Loop unrolling



Population count - counting the number of bits set



Early loop breaking



Function Design



Function call overhead



Minimizing parameter passing overhead



Leaf functions



Inline functions



Using Lookup Tables



Floating-Point Arithmetic



Misc tips



- Koushik Ghosh
Monday, January 12, 2004.