Technical Interview

Added Recently
Data Structures
Google & Microsoft
C/C++ Questions
Java Interview Questions
Quantitative Problems
Featured Articles
Amazon Interview Question
Compaq Interview Question
Technical Interview
Interview Process
Introduction Questions
Object Oriented
Google Pages
Fundamental Questions
Resume Tips
Contact Us
Submit Question/Answer
 What are some of the commonly used techniques to optimize code? 

- Code level optimization
such as
1. Optimize function calls
- use fast call, which doesn't use the stack but uses some processor registers. This is limited only when the parameters are not greater than 64 bit.

2. Optimize repeated calls
Use inline functions and macros instead of calling functions for small procedures, which abuse the stack.

3. Allocate memory all at once
instead of re-allocating memory each time you add an element.

4. Use objects instead of heap pointers as much as you can.

5. Be wise in using loops.