You (Probably) Shouldn't use a Lookup Table
I have been working on another post recently, also related to division, but I wanted to address
a comment I got from several people on the previous division article. This comment invariably
follows a lot of articles on using math to do things with chars
and shorts
. It is: “why
are you doing all of this when you can just use a lookup table?”
Even worse, a stubborn and clever commenter may show you a benchmark where your carefully-crafted algorithm performs worse than their hamfisted lookup table. Surely you have made a mistake and you should just use a lookup table. Just look at the benchmark!