3 ms·
> Yes, a binary search is just O(log(n)) but if your array isn't to big a linear search will probably be faster If your array isn't too big, it's not the bottl
by feoren 4y ago
> Yes, a binary search is just O(log(n)) but if your array isn't to big a linear search will probably be faster
If your array isn't too big, it's not the bottleneck. You're talking about tippy-top-tier optimizations to eke out the last 10% possible improvement. I'm talking about the extreme prevalence of bad, lazy, thoughtless programming needlessly slowing down most systems by 100x or more.
Maybe you work in embedded systems and drop into assembly to manually optimize a hot loop, but most of us don't. Most applications in the world send thousands of SQL queries to a database to do a job that should require only three.