On 24 October 2013 02:43, Paul Gilmartin <[email protected]> wrote:
> > The search may be terminated early (however infrequently) on > discovering an exact match. But this requires an extra comparison > if ternary results are unavailable (as they are in assembler -- > is that sufficiently on-topic?) The cost of that extra comparison > is unlikely to be offset by terminating the loop early (usually only > on the last iteration) if ternary comparisons are unavailable. > > From some code that I saw, it appeared that extra comparison was not to improve performance but rather an assumed fix for using the wrong condition for terminating the loop... But I have no right to speak after spending several hours debugging a binary search and finding the input was not sorted on that key ;-) Rob
