Algorithmic Optimizations Flashcards
What is Strength Reduction?
Replace expensive operations with simpler ones.
i.e simplifying use logical and mathematical identities or using addition instead of multiplication
What is an inline Routine?
Replacing function call with the body of the method being called. This reduces overhead from call stack and updating pointers. However, this also gives calling method extra access to variables, code duplication in binary file and increase/decrease cache misses.
What is low-level routine?
Switching out to a lower level language to write a routine. i.e switching from java to C++ or switching from C++ to assembly.
What is re-write routine?
re-write built in functions in language so that they are less expensive.
What is Pre-computation?
Idea: better to do work at compile time instead of runtime.
Good way to achieve this is to precompute values and store in constants, arrays or file.
What is Data Types?
Use simplest data type possible. i.e int instead of float or use primitive instead of object.
What is Array indexing?
- Orient arrays around language i.e Java and C++ are row major languages
- Reducing array dimensions saves computation
- Minimize array references saves time as well