3 ms·
Except on modern architectures your intuition about what is actually faster is likely wrong if it’s based on just Big O operation counts. Memory locality, pref
by kasey_junk 4y ago
Except on modern architectures your intuition about what is actually faster is likely wrong if it’s based on just Big O operation counts.
Memory locality, prefetching and branch prediction are all likely more important to actual performance than Big O complexity and those things can change from architecture to architecture.
When I was learning big o notation numa architectures where just becoming commercially viable. You’d get dramatically different performance results in one lab to the other based on which machines were in it.
- LadyCailin 4y agoMaybe, but for a given machine, a O(n) algorithm will certainly be worse than O(log n), for non-trivial sizes of n. For trivial sizes, those other things will definitely dominate, and are also good to keep in mind.