Skip to content

Commit 88ed771

Browse files
author
trasua
committed
fix typo
1 parent 11d751a commit 88ed771

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

content/english/hpc/data-structures/binary-search.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
---
22
title: Binary Search
33
weight: 1
4+
published: true
45
---
56

67
<!-- mention interpolation search and radix trees? -->
@@ -184,7 +185,7 @@ int lower_bound(int x) {
184185
185186
Note that this loop is not always equivalent to the standard binary search. Since it always rounds *up* the size of the search interval, it accesses slightly different elements and may perform one comparison more than needed. Apart from simplifying computations on each iteration, it also makes the number of iterations constant if the array size is constant, removing branch mispredictions completely.
186187
187-
As typical for predication, this trick is very fragile to compiler optimizations — depending on the compiler and how the funciton is invoked, it may still leave a branch or generate suboptimal code. It works fine on Clang 10, yielding a 2.5-3x improvement on small arrays:
188+
As typical for predication, this trick is very fragile to compiler optimizations — depending on the compiler and how the function is invoked, it may still leave a branch or generate suboptimal code. It works fine on Clang 10, yielding a 2.5-3x improvement on small arrays:
188189
189190
<!-- todo: update numbers -->
190191

0 commit comments

Comments
 (0)