From 63aec2106550c5b0c39ff9417aa1328f01b115e0 Mon Sep 17 00:00:00 2001 From: mossroy Date: Mon, 8 Jul 2013 13:59:27 +0200 Subject: [PATCH] If we find the exact title when doing the binary search, it's no use searching more. It's a small optimization. --- js/lib/evopedia.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/js/lib/evopedia.js b/js/lib/evopedia.js index 4d0c7eda..a792bf90 100644 --- a/js/lib/evopedia.js +++ b/js/lib/evopedia.js @@ -228,7 +228,14 @@ define(function(require) { lo = mid + newLineIndex - 1; } else { + if (comparison > 0) { hi = mid; + } + else { + // We found the exact title + callbackFunction(mid + startIndex - 15); + return; + } } } currentLocalArchiveInstance.recursivePrefixSearch(reader, normalizedPrefix, lo, hi, callbackFunction);