About me

我的相片
I'm a web and software developer from Kaohsiung, Taiwan.
I design and implement user interfaces, also contribute to open source projects.
http://penkia.net/portfolio

2008年7月17日 星期四

Some thoughts on speed up firefox start time

This is common issue, it's getting critical when the kernel takes 10 seconds to mount root, but firefox spends around 40 seconds to make a first start.

If we use a simpler XUL interface and xulrunner instead of original firefox, it can save about 9 seconds. (Maybe that's why the Prism project exists :-)

After profiling we can find out the problem is caused by a huge amount of I/O, the first start of xulrunner will read nearly 75MB files including .so, .xpt and fonts. (See the whole files list: readahead.txt )

Survey

Here's some common approach:
  • UPX - binary compression
  • prelink - static library
  • readahead - prefetching files
  • swiftweasel - CPU optimization
So I decide to try on prefetching, by using simple command: cat `cat readahead.txt` >> /dev/null .

Result

Sorted by total time:





mountprefetchxulrunnertotal time
no-prefetch10sN/A28s40s
parallel-prefetch10s23s 44s
prefetch10s16s15s46s
toram-prefetch20s14s15s51s
You may notice there's no mechanism to ensure reusing of cached file, so the prefetching total times is longer, although the start time is reduced.

Conclusion

  1. file priority or size should be taken into account when prefetching
  2. the next bottleneck target is the start script (xulrunner-1.9 or run-mozilla.sh), it takes 7 seconds
  3. standalone firefox?

沒有留言: