At Realm, we’re always looking for ways to optimize for speed. This is the story of how we developed our own fast binary search function, with an execution time on average 24% faster than the C++ STL. Why Binary Search? Realm stores data in binary tree structures. For example, suppose Realm was holding objects with the following IDs in a linked list: If you wanted to find the object with ID equale