samedi 16 juillet 2016

What does it mean to convert a function to a table look up?

In this video titled Don't fear the monad, between 05:02 and 06:05, Brian Beckman says:

Every imperative programmer goes through this phase of learning that functions can be replaced with table look-ups. Often, you do this for performance. You want to make the sin function or the cosine function, just make a table and interpolate in that table....Everybody learns this trick.

I am wondering what he means by this trick and how it improves performance. Could you please elaborate?

Does it just mean having some sort of a look up like Dictionary<TKey, Func<TReturn>>?

Aucun commentaire:

Enregistrer un commentaire