Bug 12148 - WebIconDatabase causes inordinate load times
Summary: WebIconDatabase causes inordinate load times
Status: UNCONFIRMED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Page Loading (show other bugs)
Version: 419.x
Hardware: Mac OS X 10.4
: P2 Normal
Assignee: Brady Eidson
URL: http://blog.amber.org/2007/01/07/safa...
Keywords:
Depends on:
Blocks:
 
Reported: 2007-01-06 21:39 PST by Chris Petrilli
Modified: 2007-01-12 13:00 PST (History)
3 users (show)

See Also:


Attachments
ls -lAR dump of ~/Library/Safari/Icons (2.79 KB, text/plain)
2007-01-08 16:01 PST, Chris Petrilli
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Petrilli 2007-01-06 21:39:22 PST
I've documented this more extensively on the web-page linked above, however the basic problem is that Safari was beginning to take 10-15 seconds minimum to load on a MacBook Pro w/2GB of RAM. Absurd. I did some looking around, and poked around with Shark, and it seems to be taking huge amounts of time rebuilding the WebIconDatabase.

By disabling this (defaults write com.apple.safari WebIconDatabase -bool false), I reduced the startup time to 1 second, which is more normal. I'm not sure what causes this, and I'd be happy to provide my icon directory to see if people can make more sense of it than I can, but for now this has resolved it.
Comment 1 Chris Petrilli 2007-01-06 21:45:29 PST
I tried to attach the Shark file, but it's too big and choked MySQL. You can find it here:

http://blog.amber.org/code/Safari.mshark
Comment 2 Dave Hyatt 2007-01-06 22:55:46 PST
Are you running nightlies?  The nightlies use a whole new icon database.
Comment 3 Mark Rowe (bdash) 2007-01-07 01:20:08 PST
I believe that twothings play a factor in how long the icon database takes to do its thing:  the number of bookmarks you have, and the number of history items you have.  Can you provide a bit of info about the approximate size of each of these in your situation?

As Dave mentions, the nightly builds use a new implementation of the icon database.  It would be great if you could head over to http://nightly.webkit.org/ and grab a build to see if they improve on the issue you are seeing.  It's likely that the first run of the nightlies will be slower than subsequent runs, as it will convert your existing icon database over to the newer format.

Thanks very much for filing the bug report rather than just blogging about it!
Comment 4 David Kilzer (:ddkilzer) 2007-01-07 04:00:48 PST
(In reply to comment #3)
> I believe that twothings play a factor in how long the icon database takes to
> do its thing:  the number of bookmarks you have, and the number of history
> items you have.  Can you provide a bit of info about the approximate size of
> each of these in your situation?

Specifically, we're looking for the size of the following files:

~/Library/Safari/Bookmarks.plist
~/Library/Safari/History.plist
~/Library/Safari/Icons/icon.db

Is there a better way to get a count?

Comment 5 Chris Petrilli 2007-01-07 06:28:03 PST
I haven't tried the nightlies -- mostly because when I do web design, I can't assure myself that anyone else has them, so I need to track the released code. If there's a way to go backwards, that'd be nice too. I'd be happy to try it out to see if things have changed.

Here's the sizes:

Bookmarks.plist = 84234
History.plist = 22787
icons.db = 12288

Now, a vast majority of those bookmarks are straight up in the Bookmarks menu, not in any folder, and so I wonder if it's dealing with them during startup, where-as it might deal with them differently were they in folders? (I use Quicksilver to trigger them)

When I went to look at the contents of my bookmarks, however, it seems that a vast majority are actually the "defaults" that I never got rid of. That's the ones that came pre-marked in Mac OS. Interesting.

If I re-enable the WebIconsDatabase option after deleting all the "factory set bookmarks," the load time stays approximately the same -- 1sec or less. Just a reference point, but interesting.
Comment 6 Chris Petrilli 2007-01-07 06:37:23 PST
(In reply to comment #5)
> I haven't tried the nightlies -- mostly because when I do web design, I can't
> assure myself that anyone else has them, so I need to track the released code.
> If there's a way to go backwards, that'd be nice too. I'd be happy to try it
> out to see if things have changed.

Obviously I spoke too soon. I didn't realize that the nightlies were distributed as full applications and not just the WebKit framework -- my concern. I tried it out, and as expected, it took a while to load the first time, but then seems to load 20-25% faster after that from the current v419 Safari. Unfortunately, in my short sightedness, I had already trimmed the bookmarks back down. The original ones, specifically. I will try and grab them off another machine to see if I can reproduce it.
Comment 7 Brady Eidson 2007-01-08 10:44:54 PST
Chris - I'm a bit confused.  If the original problem was in shipping Safari 2.04, and you'd never run the nightlies, you shouldn't have had ~/Library/Safari/Icons/icon.db as it is only generated by the nightlies.

Tiger WebKit stores the icons in a directory tree starting at ~/Library/Safari/Icons/00...15

If you had the icon.db file it would seem that at least at one time since August you *had* run the nightlies.

Anyways, let us know what else you find out!
Comment 8 Chris Petrilli 2007-01-08 16:01:45 PST
Created attachment 12316 [details]
ls -lAR dump of ~/Library/Safari/Icons

This is a dump of the Icons directory for assistance. There doesn't seem to be that much in it.