Optimize contact search by using a Ternary Search Tree.

This change updates search fragment to now preprocess query
results and hold them in memory. This significantly improves the
lookup runtime to be O(logn) on average and O(N) worst case.

Bug: 69100384
Test: existing (plus some time measurement regression tests)
PiperOrigin-RevId: 175891990
Change-Id: I6d7ae61c478b544af42d954af4e8580e052693ba
3 files changed