The Learning Behind Gmail Priority Inbox [pdf]
static.googleusercontent.com
static.googleusercontent.com
Would gmail be a desktop client, instead of a webmail, the problem would be much easier. But of course it would probably never get millions of users in the first place.
Yet, I'm pointing this out because while everyone can see the benefits of moving into the cloud, it's quite easy to forget that that in doing so we also give up on the processing power of the clients, and that their cumulative total is far from insignificant.
disclaimer: I'm working on a desktop client for gmail.
you simply cannot do this on a desktop system unless you pull in data from other users. you might be able to do that but: bandwidth, privacy concerns, and you might find you have to do just as much work to get the same performance.