Closed
Bug 1071448
Opened 10 years ago
Closed 10 years ago
BinarySearch.jsm: Optimize the search algorithm a little
Categories
(Toolkit :: General, defect)
Toolkit
General
Tracking
()
RESOLVED
FIXED
mozilla35
People
(Reporter: WeirdAl, Assigned: WeirdAl)
References
()
Details
Attachments
(1 file)
(deleted),
patch
|
adw
:
review+
|
Details | Diff | Splinter Review |
By replacing:
let mid = Math.floor((low + high) / 2);
with:
let mid = (low + high) >> 1;
we can make the binary search code about 2.5x as fast as it is now. I don't know who came up with this idea, but it works.
Assignee | ||
Comment 1•10 years ago
|
||
Attachment #8493559 -
Flags: review?(adw)
Comment 2•10 years ago
|
||
Comment on attachment 8493559 [details] [diff] [review]
Speed up binary searches using a bitwise operation.
Review of attachment 8493559 [details] [diff] [review]:
-----------------------------------------------------------------
Thanks, Alex.
Attachment #8493559 -
Flags: review?(adw) → review+
Assignee | ||
Updated•10 years ago
|
Attachment #8493559 -
Flags: checkin?(adw)
Comment 3•10 years ago
|
||
It's not convenient for me to check this in right now, so I'll mark the bug as checkin-needed instead.
No try push necessary: relevant test passes locally, very small change.
Updated•10 years ago
|
Attachment #8493559 -
Flags: checkin?(adw)
Comment 4•10 years ago
|
||
Keywords: checkin-needed
Whiteboard: [fixed-in-fx-team]
Comment 5•10 years ago
|
||
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Whiteboard: [fixed-in-fx-team]
Target Milestone: --- → mozilla35
You need to log in
before you can comment on or make changes to this bug.
Description
•