Move linear search to binary search.

For the 100000 searches done during the unit test, this drops the cpu
cycles from 74M down to 17M.