Discard Superfluous Precision

A family of OptimizationPatterns. Some examples include:

Use a table lookup instead of a pure function - this restricts precision of the input variable(s) to a certain number of bits, but on some architectures is faster than the function itself [WARNING: not as true today as it was 5 years ago!!!]

When doing a big multiplication, from 4 smaller ones, see if you can't forget about the lowest-precision multiplication.

Low-precision fixed-point arithmetic may provide results that are just as useful for your application as mega-precision floating-point arithmetic would be.

However, on some processors floating-point is highly optimized and can be faster than fixed-point.

If you have 4 32-bit integers which really range from -64 to +64, you can often stuff them ALL into a single 32-bit integer and execute pseudo-vector operations. This was often used in software texture-mapping engines to speed up the U and V updates.

Colour data, usually 24-bit, can often be reduced to 16-bits. Vertex data can often be delta-encoded. Any form of lossy compression is an example of the DiscardSuperfluousPrecision pattern - e.g. JPEG, MP3.


CategoryOptimization


EditText of this page (last edited February 24, 2011) or FindPage with title or text search