|6 degrees of separation
||[Jan. 24th, 2004|09:16 pm]
I implemented 6 degrees of separation tonight for LiveJournal. It took all of about an hour.
It looks like I started working on it 3 years ago once because when I went to type:
$ emacs dev/6d.pl
I expected to get a new file, but there was already something there! And I knew it was old code because it used the ancient LJ APIs (which no longer worked). An ls -l dev/6d.pl showed a date in Dec 2000! Crazy.
Anyway, memcache made it easy, and I've known how I'd implement it for the past 3 years apparently.... just never got back around to it.
Don't expect it on the live site anytime soon, but it'll probably get posted to lj_dev/lj_nifty for testing in a bit here.
lj@mayor:~$ time dev/6d.pl brad elims | tail -2
returning via friend-of-friend intersection with friendof-friendof
PATH: (2)brad, (1635)revjim, (438547)babycola, (714565)dorsai, (1095875)elims,
Note: That's without prefetching certain memcache objects in big requests so there are a lot of unnecessary round-trips in there still. The time will come down. I'm also not caching any subpaths yet.
Also consider it takes 0.6 seconds just to invoke Perl loading the LJ libraries. So not bad.