<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Vladimir Vukićević &#187; Braindump</title>
	<atom:link href="http://blog.vlad1.com/category/braindump/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.vlad1.com</link>
	<description>Words</description>
	<lastBuildDate>Mon, 26 Jul 2010 21:05:48 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Startup, part 1</title>
		<link>http://blog.vlad1.com/2009/07/27/startup-part-1/</link>
		<comments>http://blog.vlad1.com/2009/07/27/startup-part-1/#comments</comments>
		<pubDate>Mon, 27 Jul 2009 17:32:34 +0000</pubDate>
		<dc:creator>vladimir</dc:creator>
				<category><![CDATA[Braindump]]></category>
		<category><![CDATA[Mozilla]]></category>

		<guid isPermaLink="false">http://blog.vlad1.com/?p=143</guid>
		<description><![CDATA[I&#8217;ve been digging into startup time for the past little while, looking at both warm and cold startup, and trying to figure out where some of the pain lies.  So far I&#8217;ve only been looking at MacOS X, mainly because it has an easy way to flush filesystem caches (&#8220;purge&#8221;); I&#8217;d be doing this work [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been digging into startup time for the past little while, looking at both warm and cold startup, and trying to figure out where some of the pain lies.  So far I&#8217;ve only been looking at MacOS X, mainly because it has an easy way to flush filesystem caches (&#8220;purge&#8221;); I&#8217;d be doing this work on Windows if there was something similar there.</p>
<p>Warm start: ~900ms.  Cold start: ~10,000ms.  Youch.  The only difference between the two is disk IO; in the warm start case, most of the data has already been read in from disk, so looking at warm start can indicate where actual computation is taking place.  Using some instrumentation from <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=480735">bug 480735</a>, here&#8217;s what the breakdown is like:</p>
<style>.timelist tr > td:first-child { text-align: right; }</style>
<p><center><br />
<table class="timelist" borders="1">
<tr>
<td>0.6%</td>
<td>XRE startup</td>
</tr>
<tr>
<td>0.1%</td>
<td>pre-XPCOM startup</td>
</tr>
<tr>
<td>12.4%</td>
<td>XPCOM, network, app-startup</td>
</tr>
<tr>
<td>9.6%</td>
<td>CreateHiddenWindow</td>
</tr>
<tr>
<td>8.9%</td>
<td>EM &#038; cmdline</td>
</tr>
<tr>
<td>65.7%</td>
<td>Main thread event processing</td>
</tr>
</table>
<p></center></p>
<p>We do a bunch of work on the main thread asynchronously, including doing InitialReflow for browser.xul, which takes around 16% of the total time (<a href="https://bugzilla.mozilla.org/show_bug.cgi?id=506416">bug 506416</a>).  Those numbers are actually with a patch for <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=506470">bug 506470</a>; we were connecting to the Growl service early on in startup, for no good reason&#8230; and doing that connection was slow.  Another mac-specific issue that&#8217;s patched out in the numbers above is doing initial checking of plugins, <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=506472">bug 506472</a>.</p>
<p>Other things that are interesting is that doing UTF8 to UTF16 conversion shows up as single-digit percentages in the overall function profile.  I&#8217;ve filed <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=506430">bug 506430</a> on optimizing UTF8 to UTF16, since this will affect pageload time as well, but <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=506431">bug 506431</a> is about figuring out how to avoid it entirely at startup, by fastloading more things (css and xbl, in particular).</p>
<p>I also spent a bit figuring out which timers are being fired at startup&#8230; there&#8217;s a bunch of stuff here, some of which we should be able to optimize.  The dump there is on a <a href="http://blog.vlad1.com/startup-stuff/">startup stuff</a> page.</p>
<p>I need to repeat all of this with cold startup, including figuring out why it&#8217;s taking so long to read the data that we have.  We also need to figure out where each of the events that take significant amounts of time are coming from; the initial reflow for the main browser UI is a chunk of that, but there are still a bunch of events that are taking between 20-50ms.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.vlad1.com/2009/07/27/startup-part-1/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>
