
The Inside Story of How One Company Didn’t Mine Facebook - nreece
http://www.wired.com/epicenter/2010/06/facebook-thefind/
======
patio11
_Checking 5,000 possible candidates against a list of 7,000 known stores
couldn’t happen instantly on login. That could be 35 million comparisons per
user, which is a big number, no matter how well you optimize your algorithm._

Some days I weep for our industry. You can do this, trivially, in one lookup
per favorite-d store. Create a hash set of the stores you are interested in,
grab the favorites, check if they are in the hash set. The worse case
performance will be 5,000 times the cost of one hash lookup. (You can do it in
the application server's memory or in memcached/redis/etc.) The typical case
performance will be virtually instantaneous since most users will have
virtually no favorites.

In practice, the bottleneck will almost certainly be how fast you can get
results from the Facebook API.

