Just a little bit more on my Facebook. I’ve finally gotten the functionality perfect. Unfortunately the actual loading time of the app is exponentially poor, taking longer to load the more friends a user has.
Why? It’s quite simple. For each friend listed there are a series of queries run. These queries equal to the number of friends you have, to check and see which of them are common friends. As a result of this a user with 10 friends will run 100 queries (10 friends, 10 queries each) and a friend with 20 friends will run 400 queries (20 friends, 20 queries each).
As you can imagine this gets pretty insane when you get pretty high up there with friends. A user with 500 friends run 250,000 queries (500 friends, 500 queries each), which is just insane. If anyone has a suggestion on how to make this not so insane I’d love to hear it, as Facebook seems to lack a functionality to identify common friends in bulk.