mit-crpg/openmc — pull request #147 by cbrachem (2013-02-20 12:08:53+00:00)
Title: Simplified the binary search, making it faster.

I have simplified the binary search algorithm. The checks if `array(L) < val < array(L+1)` (and with `R`) consume more time than they save, so I've taken them out.
Also, with the new implementation, it is impossible for the loop to get trapped, rendering the check on `n_iteration` unnecessary. (Frankly, I'm not sure if it was possible before to end up there, but this way is definitely safe.)

The code change results in a notably faster binary search, yielding a total performance improvement in the order of one percent.