A must-read followup that explores other data structures for geofencing:
https://medium.com/@buckhx/unwinding-uber-s-most-efficient-s...
https://medium.com/@buckhx/unwinding-uber-s-most-efficient-s...
I am surprised they're scanning each city linearly, even a crude index (such as boxing), or a binary search would greatly improve the lookup time. I guess if the data fits into the cpu cache the order these are scanned doesn't matter so much?