4 ms·
Regardless of the arguments this article makes, it can be surprising. One time back in the Core 2 days I was optimizing an alpha blend in software and I had som
by fluoridation 3y ago
Regardless of the arguments this article makes, it can be surprising. One time back in the Core 2 days I was optimizing an alpha blend in software and I had something like x * y / 255. That operation was a tiny bit slower than table[(x << 8) | y].
- hajile 3y agoShift is one cycle. Or is one cycle. If your table is using a fast algorithm, it’s going to add a few more cycles and a couple very predictable branches. Meanwhile, divide is insanely slow. If your table is in L1 or L2 cache, it should be faster than the divide, but if not, I’d guess it would be slower. As the article says, that’s why you test then hope it doesn’t change later.
- fluoridation 3y agoSure, but my point is, how fast does the operation need to be and how slow does accessing the table need to be for the LUT to not be worth it, if a multiplication and a division is too slow?