Safari’s cookie problem

*scottstuff*: Speeding up Safari (2):

So, if Safari’s running slow, try cleaning out your cookies.

Update: Thinking about it a bit more, it seems obvious what’s happening—every single HTTP request does a linear read of the cookie database. With some sites, a decent percentage of the HTTP requests also result in a write to the cookie database. Most likely, this triggers a reader-writer lock of the cookie DB, so the write stalls waiting for a bunch of slow reads, and then a handful of writes back up one after the other, so even if the cookie handling is only eating 9% of the CPU, the total wall-clock time lost due to locking could easily be really substantial. Even worse, this effectively serializes HTTP requests, limiting the system to one cookie-invoking request at a time. That’d explain a lot of the weird behavior that I’ve seen in Safari, where one slow website will block a dozen tabs from loading. Does anyone know if Tiger has a new cookie implementation? Any decent database system will solve all of these problems.

I wonder if someone could write a hack that intercepts those requests and handles the IO with something more efficient. Could be a good proof of concept to convince Apple to make it work that way.

So does FireFox handle things differently? I don’t know if I could tell but perhaps someone is looking into that.

Leave a Reply

Your email address will not be published. Required fields are marked *