4 ms·
For a range that small you could even build a lookup table. Or is this a case where cheap computation beats memory access?
by thijsvandien 8y ago
For a range that small you could even build a lookup table. Or is this a case where cheap computation beats memory access?
- mark-r 8y agoFor modern processors you can assume that a couple of instructions will be much faster than a memory lookup. Even if the lookup is cached it will most likely push something else important out of cache.
- Const-me 8y agoOn modern hardware, computation beats RAM access almost always. Here's a repo with 2 tests, counting bits, and calculating sine/cosine: https://github.com/Const-me/LookupTables https://github.com/Const-me/LookupTables Neither code is particularly cheap but still faster than RAM.