[Lucene - Improve the BSearch Performance] Add two conditions to improve the performance of Binary Search

2014-08-05 Thread Fuxiang Chen
Dear Lucene Developers, In the source file "SortedIntDocSet.java", the code fragment that is used for binary search can have its speed improved by adding two more conditions. Original Code if (docb < doca) { low = mid+1; } else if (docb > doc

Re: [Lucene - Improve the BSearch Performance] Add two conditions to improve the performance of Binary Search

2014-08-06 Thread Michael McCandless
Hmm, but in Lucene, a SortedIntDocSet should never contain duplicates? Also, there are multiple binary searches in that source ... I'm not sure which one(s) you're trying to speed up, and I don't see how adding more conditionals would make the code faster. Mike McCandless http://blog.mikemccandl

Re: [Lucene - Improve the BSearch Performance] Add two conditions to improve the performance of Binary Search

2014-08-07 Thread Michael McCandless
But I'm still confused how this reduces the number of iterations of the binary search when the array has no duplicates in it? Mike McCandless http://blog.mikemccandless.com On Wed, Aug 6, 2014 at 6:49 PM, Fuxiang Chen wrote: > Dear Michael, > > > Thank you for the prompt reply. We truly apprec