Due to a simpler cache mechanism, the fatal error that was present in the 7.x-1.x-dev release up to ad024b4a isn't in the 6.x-1.x release, but getting rid of drupal_write_record gives a performance boost that's significant enough to make it worthwile to backport.
Close the client connection before bootstraping Drupal and logging the request, which improves the perceived performance.
Conflicts: jstats.inc