To speed up a computation process significantly, a lookup table can be used instead of calculating values at runtime.

A classic example is a trigonometry table. Calculating sine for a value will take a lot of time, so a program often takes a few seconds before starting to precalculate sine, cosine and the tangent for a number of values, 360 for example. When the program wants to make a trigonometry calculation, it uses the lookup table to retrieve the value from a memory address instead of calculating it using a mathematical formula. The speed gain is significant, because the CPU is using much fewer clock cycles to retrieve a value from memory rather than calculating it.

A = 5 * sin(20); // A function call to a complicated formula

becomes

A = 5 * sin_lookup[20]; // Retrieve the value from the array