4 ms·
Calculating that text is too slow to do repeatedly every time the pointer moves, so you're going to have to write the text into a once into buffer, and then jus
by timrobinson 16y ago
Calculating that text is too slow to do repeatedly every time the pointer moves, so you're going to have to write the text into a once into buffer, and then just blit the buffer to the screen
This sounds like an example of memoization. The buffer is allocated once, on demand, and presumably reallocated when the text changes. Mutable state is involved, but it's hidden inside your memoization function, which is typically provided by the language. You supply a function like: λ string -> GraphicsBuffer.