Idea

A function that depends on only one coordinate can be precomputed into a table, once per row or per column

Info

Originally written in French. Translated by AI — the meaning has been preserved, not the prose.

Main idea

When a term in a formula depends only on the column or only on the row, it does not need to be recomputed for every pixel. On a 320 × 200 screen, the formula $(x + y)\sin x$ requires $64\,000$ calls to Sin if computed naively; by precomputing SinX[320] and CosY[200], only 520 are needed.

The same logic produces other tables in 1990s demos: Mul320[y] = 320y to avoid one multiplication per pixel, CARRE[n] = n², the triangular numbers $n(n+1)/2$ computed once and then read.

Why it matters

Separability turns a cost proportional to area into a cost proportional to perimeter. On a processor without a coprocessor, where every sine is emulated, it is the difference between a slow image and an animation.

Nuances and limits

The gain vanishes as soon as the term depends on both coordinates at once; you then need a two-dimensional table as large as the screen.

Open questions

  • Beyond what table size does a memory read cost more than the computation, on a modern processor with caches?