Given an element and an array, the Ruby#index method returns the position of the element in the array. I implemented my own index method using binary search expecting mine w
The built-in #index is not a binary search, it's just a simple iterative search. However, it is implemented in C rather than Ruby, so naturally it can be several orders of magnitude faster.