4 ms·
>> ...use linear search if your array is below around 64 elements in size, binary search if it’s above. Back around 1980 when I first looked into this the gen
by mhewett 12y ago
>> ...use linear search if your array is below around 64 elements in size, binary search if it’s above.
Back around 1980 when I first looked into this the generally accepted cutoff was 25 rather than 64. I don't think people were unrolling loops in the tests back then so it's hard to tell whether loop unrolling or changes in CPU architecture is the greater factor in moving the cutoff point from 25 to 64.
- JoeAltmaier 12y agoSomething to do with the ratio between instruction cache size and cost of a jump to the pipeline?
- TrainedMonkey 12y agoI suspect memory bus width and latency also plays a role.