<?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>Brad&#039;s blog</title>
	<atom:link href="http://blog.lassey.us/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.lassey.us</link>
	<description>sorry for random</description>
	<lastBuildDate>Thu, 04 Aug 2011 19:54:52 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>NDKr5 in production</title>
		<link>http://blog.lassey.us/2011/08/04/ndkr5-in-production/</link>
		<comments>http://blog.lassey.us/2011/08/04/ndkr5-in-production/#comments</comments>
		<pubDate>Thu, 04 Aug 2011 19:54:52 +0000</pubDate>
		<dc:creator>Brad Lassey</dc:creator>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[mobile]]></category>
		<category><![CDATA[Mozilla]]></category>

		<guid isPermaLink="false">http://blog.lassey.us/?p=190</guid>
		<description><![CDATA[Firefox 8 for Android is now being built with NDKr5. Bug 657723 tracked deploying the updated NDK to our build slaves and updating the configuration to use it. After a couple of hiccups along the way we started producing on change builds with it on Wed July 27th and the first NDKr5 built nightly went [...]]]></description>
			<content:encoded><![CDATA[<p>Firefox 8 for Android is now being built with NDKr5. <a href="http://bugzil.la/657723">Bug 657723</a> tracked deploying the updated NDK to our build slaves and updating the configuration to use it. After a couple of hiccups along the way we started producing on change builds with it on Wed July 27th and the first NDKr5 built nightly went out the following Thursday. We will build Firefox 6 and Firefox 7 with NDKr4 as we want to get a full development cycle&#8217;s worth of testing with the new toolchain.</p>
<p>This is important for a couple reasons. First, it gave us some nice performance improvements. I&#8217;d love to show you some nice graphs that illustrate that, but our data is so noisy that it depresses me. Anecdotally, several Mozillians have come on the #mobile irc channel in the last few days to comment on the improved snappiness they&#8217;d noticed over the weekend.</p>
<p>But, the biggest thing for me is that you can now build Firefox for Android using a stock NDK. Previously you had to use our custom built NDK (which was built on the <a href="http://www.crystax.net/android/ndk.php">crystax NDK</a>) to support the usage of STL in Mozilla. This should make it much easier for your casual Android developer to drop in and contribute to Firefox on Android.</p>
<p>To get started building Firefox for Android with NDKr5, check out the <a href="https://wiki.mozilla.org/Mobile/Fennec/Android">build instructions here</a>. Or if you want to get started a little more quickly, you can grab the <a href="http://blog.lassey.us/2011/07/22/updated-android-development-vm/">development VM I posted about</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.lassey.us/2011/08/04/ndkr5-in-production/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Updated Android Development VM</title>
		<link>http://blog.lassey.us/2011/07/22/updated-android-development-vm/</link>
		<comments>http://blog.lassey.us/2011/07/22/updated-android-development-vm/#comments</comments>
		<pubDate>Fri, 22 Jul 2011 19:55:01 +0000</pubDate>
		<dc:creator>Brad Lassey</dc:creator>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[mobile]]></category>
		<category><![CDATA[Mozilla]]></category>

		<guid isPermaLink="false">http://blog.lassey.us/?p=186</guid>
		<description><![CDATA[About a year ago I posted a VMWare VM that had been set up to build Fennec for Android. That was still pretty early in the development of Fennec for Android and things have changed a lot since then. In particular, we now support developing with a stock NDKr5 (or NDKr6). So, I&#8217;ve created a [...]]]></description>
			<content:encoded><![CDATA[<p>About a year ago I posted a VMWare VM that had been set up to build Fennec for Android. That was still pretty early in the development of Fennec for Android and things have changed a lot since then. In particular, we now support developing with a stock NDKr5 (or NDKr6). So, I&#8217;ve created a new VM with these updated tools and an updated tree, which can be found <a href="http://lassey.us/AndroidDevVM.7z"> here</a>.<br />
We&#8217;ll be moving to NDKr5 for our production builders as soon as we can resolve some issues we have with our testing automation. You can follow that progress with <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=657723">bug 657723</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.lassey.us/2011/07/22/updated-android-development-vm/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Slight change to mobile tracking flags</title>
		<link>http://blog.lassey.us/2011/07/22/slight-change-to-mobile-tracking-flags/</link>
		<comments>http://blog.lassey.us/2011/07/22/slight-change-to-mobile-tracking-flags/#comments</comments>
		<pubDate>Fri, 22 Jul 2011 17:51:18 +0000</pubDate>
		<dc:creator>Brad Lassey</dc:creator>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[mobile]]></category>
		<category><![CDATA[Mozilla]]></category>

		<guid isPermaLink="false">http://blog.lassey.us/?p=184</guid>
		<description><![CDATA[Since we switched to the rapid release process, the mobile team has been using tracking-fennec to track bugs we care about for a particular release (so that tracking-fennec=7+ means the patch or feature either landed in Firefox 7 or we expect it to). Yesterday we added another possible value to that in just a plain [...]]]></description>
			<content:encoded><![CDATA[<p>Since we switched to the rapid release process, the mobile team has been using tracking-fennec to track bugs we care about for a particular release (so that tracking-fennec=7+ means the patch or feature either landed in Firefox 7 or we expect it to). Yesterday we added another possible value to that in just a plain plus (&#8220;+&#8221;).<br />
The motivation for this change is that there is a set of bugs that we know we care about and want to keep &#8220;on the radar&#8221; but that we can&#8217;t say with any certainty will land in a given release. When we get more clarity on that we can change the tracking flag to reflect that new information.<br />
Since we&#8217;re not tracking the bugs marked tracking-fennec=+ for a given release, the drivers won&#8217;t be as religious about finding assignees for them. So if you&#8217;re looking for something to work on, have a look at the queries listed under &#8220;Bugs to pick up&#8221; on <a href="https://wiki.mozilla.org/Mobile/Triage"> this page</a>. They are essentially <a href="https://bugzilla.mozilla.org/buglist.cgi?order=Last%20Changed&amp;field0-0-0=cf_blocking_fennec&amp;resolution=---&amp;query_format=advanced&amp;type0-0-0=substring&amp;value0-0-0=%2B">open, tracked bugs</a> and <a href="https://bugzilla.mozilla.org/buglist.cgi?order=Last%20Changed&amp;field0-0-0=cf_blocking_fennec&amp;resolution=---&amp;emailtype1=exact&amp;query_format=advanced&amp;emailassigned_to1=1&amp;email1=nobody%40mozilla.org&amp;type0-0-0=substring&amp;value0-0-0=%2B">unassigned, open tracked bugs</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.lassey.us/2011/07/22/slight-change-to-mobile-tracking-flags/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Building Fennec with Android NDKr5</title>
		<link>http://blog.lassey.us/2011/05/27/building-fennec-with-android-ndkr5/</link>
		<comments>http://blog.lassey.us/2011/05/27/building-fennec-with-android-ndkr5/#comments</comments>
		<pubDate>Fri, 27 May 2011 20:40:09 +0000</pubDate>
		<dc:creator>Brad Lassey</dc:creator>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[mobile]]></category>
		<category><![CDATA[Mozilla]]></category>

		<guid isPermaLink="false">http://blog.lassey.us/?p=183</guid>
		<description><![CDATA[The changes required to build Fennec for Android with NDKr5 have landed. Up until now you had to use a custom built version of NDKr4 that included STL support (based off of Crystax&#8217;s NDK). Now with NDKr5, you can build Fennec with a stock NDK. There&#8217;s also a performance benefit. We&#8217;ve seen a significant performance [...]]]></description>
			<content:encoded><![CDATA[<p>The changes required to build Fennec for Android with <a href="http://developer.android.com/sdk/ndk/index.html">NDKr5</a> have landed. Up until now you had to use a <a href="http://ftp.mozilla.org/pub/mozilla.org/mobile/source/android-ndk-r4c-0moz3.tar.bz2">custom built version of NDKr4 </a>that included STL support (based off of <a href="http://www.crystax.net/android/ndk-r4.php">Crystax&#8217;s NDK</a>). Now with NDKr5, you can build Fennec with a stock NDK.</p>
<p>There&#8217;s also a performance benefit. We&#8217;ve seen a significant performance improvement in many areas from the updated toolchain. However, there is a fairly significant performance regression from JIT&#8217;d code that prevents us from switching over to the new toolchain right now. That regression is being tracked in <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=658074">bug 658074</a> and once it is resolved we&#8217;ll turn it on for the automated builders.</p>
<p>If you want to build with NDKr5, you&#8217;ll just need to make a couple changes to your mozconfig. Here&#8217;s the one I build with:</p>
<p><code><br />
# Add the correct paths here:<br />
ac_add_options --with-android-ndk="/home/blassey/android-ndk-r5"<br />
ac_add_options --with-android-sdk="/home/blassey/android-sdk-linux_86/platforms/android-8"<br />
ac_add_options --with-android-version=5<br />
ac_add_options --with-android-tools="/home/blassey/android-sdk-linux_86/tools"<br />
ac_add_options --with-android-toolchain="/home/blassey/android-ndk-r5/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86"<br />
ac_add_options --with-android-platform="/home/blassey/android-ndk-r5/platforms/android-5/arch-arm"</code></p>
<p><code># android options<br />
ac_add_options --enable-application=mobile<br />
ac_add_options --target=arm-linux-androideabi<br />
ac_add_options --with-endian=little<br />
ac_add_options --enable-debug-symbols<br />
ac_add_options --with-ccache<br />
ac_add_options --disable-tests<br />
ac_add_options --enable-crashreporter<br />
ac_add_options --disable-elf-hack<br />
</code></p>
<p>This key changes are obviously the paths and changing the target to <code>arm-linux-androideabi.</code></p>
<p>Special thanks to <a href="http://mozakai.blogspot.com/">Alon Zakai</a> for nailing down the last few issues that were stumping me.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.lassey.us/2011/05/27/building-fennec-with-android-ndkr5/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>How do you get the visible area of an Android View?</title>
		<link>http://blog.lassey.us/2011/05/16/how-do-you-get-the-visible-area-of-an-android-view/</link>
		<comments>http://blog.lassey.us/2011/05/16/how-do-you-get-the-visible-area-of-an-android-view/#comments</comments>
		<pubDate>Mon, 16 May 2011 07:47:03 +0000</pubDate>
		<dc:creator>Brad Lassey</dc:creator>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[mobile]]></category>
		<category><![CDATA[Mozilla]]></category>

		<guid isPermaLink="false">http://blog.lassey.us/?p=179</guid>
		<description><![CDATA[Most Android keyboards show what&#8217;s called an &#8220;extracted text view&#8221; when they&#8217;re in landscape mode, where it takes over the whole screen hiding the underlying application. However, you can use the EditorInfo.IME_FLAG_NO_EXTRACT_UI flag with your InputConnection to tell the keyboard not to show the extracted view. The stock browser now does this (see the source) [...]]]></description>
			<content:encoded><![CDATA[<p>Most Android keyboards show what&#8217;s called an &#8220;extracted text view&#8221; when they&#8217;re in landscape mode, where it takes over the whole screen hiding the underlying application. However, you can use the EditorInfo.IME_FLAG_NO_EXTRACT_UI flag with your InputConnection to tell the keyboard not to show the extracted view.<br />
The stock browser now does this (see the <a href="http://android.git.kernel.org/?p=platform/frameworks/base.git;a=blob;f=core/java/android/webkit/WebTextView.java#l866">source</a>) since Froyo, and you can see it in action by clicking on the search box on google.com in landscape mode. You can see that the stock browser pans the search box such that it is visible just above the keyboard. It looks like the stock browser resizes their view since you can pan to the bottom of the page within that little space above the keyboard (see screen shots).</p>
<p>What I&#8217;ve been trying unsuccessfully to figure out is how they&#8217;re getting the visible area (or perhaps, inversely, the size of the keyboard). I don&#8217;t see any API on the View, ViewGroup, ViewParent, InputConnection etc. that will give you that information. Can anyone help?</p>
<p>&nbsp;</p>
<div id="attachment_180" class="wp-caption alignnone" style="width: 610px"><a href="http://blog.lassey.us/wp-content/uploads/2011/05/stock_landscape_keyboard.png"><img class="size-full wp-image-180  " title="stock_landscape_keyboard" src="http://blog.lassey.us/wp-content/uploads/2011/05/stock_landscape_keyboard.png" alt="" width="600" height="360" /></a><p class="wp-caption-text">Search box visible above landscape keyboard</p></div>
<div id="attachment_181" class="wp-caption alignnone" style="width: 610px"><a href="http://blog.lassey.us/wp-content/uploads/2011/05/stock_landscape_keyboard_panned.png"><img class="size-medium wp-image-181 " title="stock_landscape_keyboard_panned" src="http://blog.lassey.us/wp-content/uploads/2011/05/stock_landscape_keyboard_panned-300x180.png" alt="" width="600" height="360" /></a><p class="wp-caption-text">Panned to the bottom of the page (search box still focused)</p></div>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.lassey.us/2011/05/16/how-do-you-get-the-visible-area-of-an-android-view/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Roll your own DynDNS with DreamHost&#8217;s APIs</title>
		<link>http://blog.lassey.us/2011/04/12/roll-your-own-dyndns-with-dreamhosts-apis/</link>
		<comments>http://blog.lassey.us/2011/04/12/roll-your-own-dyndns-with-dreamhosts-apis/#comments</comments>
		<pubDate>Tue, 12 Apr 2011 18:36:18 +0000</pubDate>
		<dc:creator>Brad Lassey</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.lassey.us/?p=176</guid>
		<description><![CDATA[As I tweeted last week, DynDNS killed my account again but this time I was in California for 2 weeks, leaving me without access to my home network. That was less than convenient. So, on my to-do list for when I got home was trying to figure out a more robust solution. Turns out its [...]]]></description>
			<content:encoded><![CDATA[<p>As I <a href="https://twitter.com/#!/blassey/status/54807648893280256">tweeted last week</a>, DynDNS killed my account again but this time I was in California for 2 weeks, leaving me without access to my home network. That was less than convenient. So, on my to-do list for when I got home was trying to figure out a more robust solution. Turns out its pretty simple to do with DreamHost&#8217;s APIs and a cron job. Here&#8217;s my script:<br />
<code></p>
<pre style="width:600px;background-color:white;border:dashed thin grey;overflow:auto">
KEY="YOUR_DREAMHOST_API_KEY"
HOST="your_server.you.com"
current_dns=`curl "https://api.dreamhost.com/?key=$KEY&amp;cmd=dns-list_records" 2&gt;/dev/null | grep "$HOST" | grep -Eo '([0-9]{1,3}\.){3}[0-9]{1,3}'`
current=`curl "http://lassey.us/whatsmyip.php"`
if test $current = $current_dns; then
    echo "their equal"
else
    echo `curl "https://api.dreamhost.com/?key=$KEY&amp;cmd=dns-remove_record&amp;record=$HOST&amp;type=A&amp;value=$current_dns"`
    echo `curl "https://api.dreamhost.com/?key=$KEY&amp;cmd=dns-add_record&amp;record=$HOST&amp;type=A&amp;value=$current"`
fi</pre>
<p></code><br />
And the content of http://lassey.us/whatsmyip.php is:<br />
<code></p>
<pre style="width:600px;background-color:white;border:dashed thin grey;overflow:auto">
&lt;!--?php echo getenv("REMOTE_ADDR");  ?--&gt;
</pre>
<p></code><br />
Hopefully that helps out anyone else that&#8217;s facing the same frustration.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.lassey.us/2011/04/12/roll-your-own-dyndns-with-dreamhosts-apis/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Firefox for Mobile Performance Overview</title>
		<link>http://blog.lassey.us/2011/03/29/mobile-firefox-performance-overview/</link>
		<comments>http://blog.lassey.us/2011/03/29/mobile-firefox-performance-overview/#comments</comments>
		<pubDate>Tue, 29 Mar 2011 06:00:03 +0000</pubDate>
		<dc:creator>Brad Lassey</dc:creator>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[mobile]]></category>
		<category><![CDATA[Mozilla]]></category>

		<guid isPermaLink="false">http://blog.lassey.us/?p=171</guid>
		<description><![CDATA[There are many things that can fall into the broad category of &#8220;performance.&#8221; The flavor of the month, as of late, has been &#8220;JavaScript performance,&#8221; perhaps because it&#8217;s so easy to get numbers from various test suites that can be used to compare browsers. The major advances that browsers have been making in the last [...]]]></description>
			<content:encoded><![CDATA[<p>There are many things that can fall into the broad category of &#8220;performance.&#8221; The flavor of the month, as of late, has been &#8220;JavaScript performance,&#8221; perhaps because it&#8217;s so easy to get numbers from various test suites that can be used to compare browsers. The major advances that browsers have been making in the last few years enable a whole class of web apps that were previously unthinkable.</p>
<p>But we care about many other things that could fall into the performance bucket, like the time it takes the browser to start up, which has an obvious impact on the user&#8217;s experience, especially on mobile where the browser tends to start and stop more often than desktop. Another fairly obvious performance metric is page load speed, something the user will see feel every time they use the browser.</p>
<p>Besides measuring how long things take to happen, we also care about how much space browsers take while doing it, both in terms of disk space and memory. Finally there are some things that are traditionally harder to measure, such as responsiveness.</p>
<p><span id="more-171"></span></p>
<h3>JS Performance</h3>
<p>Between Alpha 1 and Firefox 4 for Android final release we were able to increase Javascript performance across the board on major benchmarks. This includes a 1.6x improvement on Kraken,  1.9x on Sunspider and 4.1x on V8. The final release is 3.8x faster than the stock browser on Kraken, 2.2x on Sunspider and 1.7x on V8.</p>
<p>Firefox for mobile features the same JägerMonkey JavaScript engine as Desktop Firefox 4.0, which features both a whole method JIT as well as the trace JIT featured in previous versions of Desktop and mobile Firefox. Essentially, the method JIT makes everything fast by compiling almost all JS code to fast bytecode while the trace JIT finds hot spots in the code and can compile even faster byte code that makes certain assumptions based on the results of an execution trace, like the data types of variables.<br />
<img class="alignnone" title="SunSpider 0.9.1" src="https://spreadsheets.google.com/oimg?key=0AjcsKAH2v2E_dEVqeFVjUEVhTDVtd2pHRWVKQXlOTmc&amp;oid=2&amp;zx=l2kcil-2y6bes" alt="" width="600" height="371" /><br />
<img class="alignnone" title="V8 v5" src="https://spreadsheets.google.com/oimg?key=0AjcsKAH2v2E_dEVqeFVjUEVhTDVtd2pHRWVKQXlOTmc&amp;oid=4&amp;zx=vnp9ac-j6jjyp" alt="" width="600" height="371" /><br />
<img class="alignnone" title="Kraken" src="https://spreadsheets.google.com/oimg?key=0AjcsKAH2v2E_dEVqeFVjUEVhTDVtd2pHRWVKQXlOTmc&amp;oid=6&amp;zx=vxsgta-qq3r2z" alt="" width="600" height="371" /><br />
While the performance of JS has steadily improved throughout the development process, we got a particularly large performance win in Febuary when Chris Leary landed PICs for ARM, which he <a href="http://blog.cdleary.com/2011/02/picky-monkeys-pic-arm/">discussed in more depth here</a>.</p>
<h3>Install Size</h3>
<p>Firefox for mobile&#8217;s installer is 13.8Mb. That includes the ability to render the entire web in 14 languages and locales. To put that in perspective, Angry Birds&#8217; installer is 17Mb.  In many blog posts and comments on the internet I&#8217;ve seen our apk and install size compared to the stock browser, Dolphin, Opera Mini and SkyFire. I&#8217;d like to point out that those are all apples-to-oranges comparisons. For the stock browser and Dolphin, what you see reported in Android&#8217;s Application Management screen is essentially only the UI of the browser. The rendering engine, Javascript engine, networking layer and essentially everything else that makes a browser a browser are considered part of the OS and not included in what&#8217;s reported there. In the case of Opera Mini the rendering engine resides on back-end servers and not on the phone. SkyFire (for Android) is a hybrid of the two, with some rendering happening on back-end servers and some using the OS libraries. Opera Mobile Browser is a fair comparison since it ships a soup to nuts browser like Firefox. Opera&#8217;s installer is 10.5Mb and its install size is 20.5Mb, which is comparable to Firefox. Firefox will also allow you to move the entirety of the install to external storage, bringing the reported size down to about 100kb.</p>
<p>One unfortunate part of doing native development on Android is that the OS extracts your libraries from the apk on first run to your data directory. The trouble comes from the fact that you essentially have two copies of all of your libraries; one compressed copy in your apk and an extracted copy in your data directory. Opera recently <a href="http://my.opera.com/operamobile/blog/the-components-of-opera-mobile-11-on-android">blogged</a> about their own dealings with this issue.  Michael Wu was able to improve upon that by writing a custom dlopen that extracts the libraries to mmap&#8217;d shared memory. After that change, we had only one copy of our libraries in the compressed apk. Later we changed that behavior slightly for devices with at least 150Mb of free disk space. For these devices, we write out the extracted libraries out to disk after extracting them to memory. That change was made to improve start-up time, and I talk about it more below.</p>
<p>Of course all of this work is open. It would be great if Android could  add support for loading libraries directly from apk&#8217;s, but in the meantime, other Android apps using native libraries can take a similar  approach.</p>
<p>Late in the development cycle we also implemented support for moving the browser&#8217;s profile data to the SD card. Some users, especially those using our <a href="http://www.mozilla.com/en-US/mobile/sync/">Sync feature</a>, can wind up having very large profiles. After this change, if the user moves Firefox to the SD card with Froyo&#8217;s &#8220;Move to SD Card&#8221; option in the Application Management settings, the size on disk reported by Android&#8217;s Application Management is less than 100kb after the next launch (assuming the device has less than 150Mb free).</p>
<h3>Start-up Time</h3>
<p>Start-up time is another item that has improved steadily during the development of mobile and desktop Firefox thanks to the <a href="https://wiki.mozilla.org/Firefox/Projects/Startup_Time_Improvements">work of many people</a>. We made a couple of improvements that were specific to Android that I&#8217;d like to highlight.</p>
<p>Typically Android applications that include native libraries pay a particularly high price the first time they&#8217;re run as the OS extracts the libraries from the apk file. As I mentioned before, Michael Wu implemented a custom dlopen to load our libraries directly into memory. That change allowed us to reduce the cost extracting all of our libraries the first time the application is run because we only extract sections of code as they&#8217;re needed and only a small subset is required for start-up.  However, it&#8217;s not uncommon for performance work to make trade-offs of size for speed or visa-versa, and this change was no exception. While it improved first run start-up time slightly and size on disk drastically, it regressed normal start-up time slightly. A few months later we made some changes that won back that regression. Essentially, after we extract the libraries to the mmap&#8217;d shared memory, we kick off a low priority process that writes that memory out to disk. Around the same time we started calling madvise on our main library. With these changes we get our cake and eat it too. Once we get the libraries written out to disk, we use those files rather than the shared memory and don&#8217;t need to spend time extracting parts of the libraries that we already extracted in a previous run.</p>
<p>Another performance improvement that other Android developers may find interesting is with our splash screen. We found that the spinning throbber was taking up a lot more cpu cycles than one might expect. So we switched to drawing the app logo and &#8220;loading&#8221; directly to our surface and picked up about a 1s start-up time improvement!</p>
<p>In the end we were able to take start-up time from double digits down to 1-5s depending on what you measure and what device you measure it on.</p>
<h3>Page load time</h3>
<p>One of the major changes between mobile Firefox 1.1 and 4.0 is the introduction of a separate process for content to run and render in, part of the <a href="https://wiki.mozilla.org/Electrolysis">Electrolysis</a> project. The main reason for Firefox for mobile to make that change was to increase our responsiveness (more on that later), but that change almost doubled our page load times. Most of that regression can be blamed on the need to pass messages and data between the content process where the page is being rendered and the chrome process where all the network activity happens.</p>
<p>Since we landed and turned on Electrolysis, we have worked to recover the lost page load performance.  <a href="http://mozakai.blogspot.com/">Alon Zakai</a> has been doing some great work profiling the area of the code base and producing tools that can create <a href="http://mozakai.blogspot.com/2010/09/visualizing-ipc-messages-in-fennec.html">visualizations of these messages</a> which helped identify hotspots. The fruits of his labor can be seen in the massive improvements we&#8217;ve seen since our alpha releases of Fennec, through the Beta cycle and now in this release.</p>
<p>Recently Mark Finkle launched a website to collect crowd-sourced performance information, from that you can see some of the progress we&#8217;ve made over the past couple months.</p>
<p><a href="http://blog.lassey.us/wp-content/uploads/2011/03/zippity_Tp.png"><img class="alignnone size-full wp-image-172" title="Page load performance data" src="http://blog.lassey.us/wp-content/uploads/2011/03/zippity_Tp.png" alt="" width="586" height="308" /></a></p>
<h3>Memory Footprint</h3>
<p>The mobile team has been particularly interested in anything that can drive down our memory usage for obvious reasons. Besides trying to be a good citizen on resource-limited devices, Android will kill our process as soon as we go into the background in low memory conditions, which is not the greatest experience for the user.</p>
<p>One way we were able to reduce memory usage by not JIT&#8217;ing <em>all</em> JavaScript is described by <a href="http://blog.mozilla.com/nnethercote/2011/03/24/the-javascript-interpreter-isnt-dead-yet/">Nicholas Nethercote</a> in his blog. We also pay attention to the memory conditions of the device and preemptively save out the state of the browser before killing off our content process. With that saved state we can then recreate tabs as you focus on them, complete with the state you left them in, but avoid having the whole application killed off by the OS.</p>
<h3>Responsiveness</h3>
<p>One of the problems that we had with mobile Firefox 1.0 and 1.1 was that if a web page was doing something too intensive our UI would freeze up. To combat this, we split the content rendering and JavaScript execution off into its own process. We also reduce the priority of the content process (also known a&#8221;nice&#8217;ing&#8221; the process) such that the chrome process (and thus the main UI) always takes precedence when both processes compete for CPU time.</p>
<h3>Panning</h3>
<p>Panning responsiveness is a big part of user perceived performance. When you touch a page you want an immediate response, especially when kinetic pans are involved since the &#8220;weight&#8221; of the page impacts how far you think it will go. For Firefox  for mobile we&#8217;ve mad some major architectural changes that allows us to be much more responsive to the users&#8217; panning input than in previous releases. That starts with the <a href="http://weblogs.mozillazine.org/roc/archives/2010/07/retained_layers.html">layers work lead by Robert O&#8217;Callahan</a>, which allows us to quickly perform common graphical operations, retain the results from frame to frame and composite the end results. The next major break through was Chris Jones&#8217;s work on shared layers, which allows us to render to a layer in the content process while manipulating it (e.g. by panning it) in the chrome process. And finally we introduce the concept of a display port to the code base to allow us to &#8220;know&#8221; which parts of the page should be rendered even if not visible, which means that there is visible content already rendered past the edge of the screen even before the user starts to pan. For more on this, check out <a href="http://stechz.com/?p=316">Ben Stover&#8217;s recent blog post</a> with a great overview of all these optimizations.</p>
<div id="_mcePaste" class="mcePaste" style="position: absolute; left: -10000px; top: 2892px; width: 1px; height: 1px; overflow: hidden;">
<h2>Robert O&#8217;Callahan</h2>
</div>
]]></content:encoded>
			<wfw:commentRss>http://blog.lassey.us/2011/03/29/mobile-firefox-performance-overview/feed/</wfw:commentRss>
		<slash:comments>22</slash:comments>
		</item>
		<item>
		<title>Nightly updates for Fennec on Android</title>
		<link>http://blog.lassey.us/2010/09/17/nightly-updates-for-fennec-on-android/</link>
		<comments>http://blog.lassey.us/2010/09/17/nightly-updates-for-fennec-on-android/#comments</comments>
		<pubDate>Fri, 17 Sep 2010 20:48:40 +0000</pubDate>
		<dc:creator>Brad Lassey</dc:creator>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[mobile]]></category>
		<category><![CDATA[Mozilla]]></category>

		<guid isPermaLink="false">http://blog.lassey.us/?p=164</guid>
		<description><![CDATA[Alex Pakhotin did some great work over the last couple weeks to get our update system working on Android, followed up by Aki Sasaki getting all the server side bits together. The result? You&#8217;ll now get prompted to update your Fennec nightly builds on Android. Oh hey! Fennec&#8217;s trying to tell me something. Oh cool! [...]]]></description>
			<content:encoded><![CDATA[<p>Alex Pakhotin did some great work over the last couple weeks to get our update system working on Android, followed up by Aki Sasaki getting all the server side bits together. The result? You&#8217;ll now get prompted to update your Fennec nightly builds on Android.</p>
<table style="border-spacing: 75px 0px;" width="100%">
<tbody>
<tr>
<td><a href="http://blog.lassey.us/wp-content/uploads/2010/09/update-notification.png"><img class="alignnone" title="Fennec update notification" src="http://blog.lassey.us/wp-content/uploads/2010/09/update-notification-180x300.png" alt="" width="180" height="300" /></a></td>
<td><a href="http://blog.lassey.us/wp-content/uploads/2010/09/update-notification2.png"><img class="size-medium wp-image-166 alignnone" title="Fennec update notification, more details" src="http://blog.lassey.us/wp-content/uploads/2010/09/update-notification2-180x300.png" alt="" width="180" height="300" /> </a></td>
</tr>
<tr>
<td>Oh hey! Fennec&#8217;s trying to tell me something.</td>
<td>Oh cool! There&#8217;s an update available for Fennec!</td>
</tr>
</tbody>
</table>
<p style="text-align: center;">↓<br />
<a href="http://blog.lassey.us/wp-content/uploads/2010/09/update-dialog.png"><img class="size-medium wp-image-167  aligncenter" title="update-dialog" src="http://blog.lassey.us/wp-content/uploads/2010/09/update-dialog-300x180.png" alt="" width="300" height="180" /></a><br />
↓<br />
<a href="http://blog.lassey.us/wp-content/uploads/2010/09/update-dialog-progress.png"><img class="alignnone size-medium wp-image-168" title="update-dialog-progress" src="http://blog.lassey.us/wp-content/uploads/2010/09/update-dialog-progress-300x180.png" alt="" width="300" height="180" /></a><a href="http://blog.lassey.us/wp-content/uploads/2010/09/update-dialog-restart.png"></a><br />
↓<br />
<a href="http://blog.lassey.us/wp-content/uploads/2010/09/update-dialog-restart.png"><img class="alignnone size-medium wp-image-169" title="update-dialog-restart" src="http://blog.lassey.us/wp-content/uploads/2010/09/update-dialog-restart-300x180.png" alt="" width="300" height="180" /></a></p>
<p>Oh wow these dialogs are ugly. But, they get the job done for now. In fact, new, mobile-friendly dialogs have already landed, but I won&#8217;t be able to see them until tomorrow&#8217;s update. Also, for the time being these updates are &#8220;complete&#8221; meaning they&#8217;re big. Soon we&#8217;ll have support for &#8220;partial&#8221; updates which are binary diffs between builds and will be much smaller.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.lassey.us/2010/09/17/nightly-updates-for-fennec-on-android/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Script to download and resign android nightlies</title>
		<link>http://blog.lassey.us/2010/09/15/script-to-download-and-resign-android-nightlies/</link>
		<comments>http://blog.lassey.us/2010/09/15/script-to-download-and-resign-android-nightlies/#comments</comments>
		<pubDate>Wed, 15 Sep 2010 04:44:54 +0000</pubDate>
		<dc:creator>Brad Lassey</dc:creator>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[mobile]]></category>
		<category><![CDATA[Mozilla]]></category>

		<guid isPermaLink="false">http://blog.lassey.us/?p=163</guid>
		<description><![CDATA[Sometimes I have to use nightly builds to track down when regressions happen. There are two things that are annoying about that. First, I usually know I want a nightly build from a certain day, but I don&#8217;t know what hour that build was produced by the nightly builders, so I wind up scanning through [...]]]></description>
			<content:encoded><![CDATA[<p>Sometimes I have to use nightly builds to track down when regressions happen. There are two things that are annoying about that. First, I usually know I want a nightly build from a certain day, but I don&#8217;t know what hour that build was produced by the nightly builders, so I wind up scanning through a long list of folders like <a href="http://ftp.mozilla.org/pub/mozilla.org/mobile/nightly/2010/09/">this</a>. The second is that because of the way android installers are signed, I have to uninstall my private build, which blows away my profile. <a href="http://limpet.net/mbrubeck/">Matt Brubeck</a> put instructions on how to sign the the unsigned builds with your own key on the <a href="https://wiki.mozilla.org/Mobile/Fennec/Android#Android_Development_Tips">Fennec project wiki page.</a></p>
<p>So I put together a little script that tries the possible nightly build URLs until it finds one, then resigns it and installs it. Hopefully you find it helpful.</p>
<p><a href="http://www.lassey.us/getnightly.sh">http://www.lassey.us/getnightly.sh</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.lassey.us/2010/09/15/script-to-download-and-resign-android-nightlies/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Android screen shots without rooting your phone</title>
		<link>http://blog.lassey.us/2010/09/13/android-screen-shots-without-rooting-your-phone/</link>
		<comments>http://blog.lassey.us/2010/09/13/android-screen-shots-without-rooting-your-phone/#comments</comments>
		<pubDate>Mon, 13 Sep 2010 20:37:31 +0000</pubDate>
		<dc:creator>Brad Lassey</dc:creator>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[mobile]]></category>
		<category><![CDATA[Mozilla]]></category>

		<guid isPermaLink="false">http://blog.lassey.us/?p=159</guid>
		<description><![CDATA[It turns out you can take a screenshot from your android device without rooting it. Simply download the android SDK (http://developer.android.com/sdk/index.html) and extract it as instructed. In the tools folder of your SDK there is a utility program called ddms. Launch that, it should look something like this: (Note: Mac users need to launch this [...]]]></description>
			<content:encoded><![CDATA[<p>It turns out you can take a screenshot from your android device without rooting it. Simply download the android SDK (http://developer.android.com/sdk/index.html) and extract it as instructed. In the tools folder of your SDK there is a utility program called ddms.  Launch that, it should look something like this:</p>
<p><a href="http://blog.lassey.us/wp-content/uploads/2010/09/Screenshot-Dalvik-Debug-Monitor-.png"><img class="alignnone size-medium wp-image-160" title="Dalvik Debug Monitor" src="http://blog.lassey.us/wp-content/uploads/2010/09/Screenshot-Dalvik-Debug-Monitor--300x215.png" alt="" width="300" height="215" /></a></p>
<p>(Note: Mac users need to launch this with the X11 running)</p>
<p>Simply click on the device you want to take a screenshot from to select it. Then under the device menu, you&#8217;ll find &#8220;Screen capture&#8221;, which does what you&#8217;d expect it to do.</p>
<p><a href="http://blog.lassey.us/wp-content/uploads/2010/09/Screenshot-Dalvik-Debug-Monitor-screen-capture.png"><img class="alignnone size-medium wp-image-161" title="Screenshot-Dalvik Debug Monitor-screen capture" src="http://blog.lassey.us/wp-content/uploads/2010/09/Screenshot-Dalvik-Debug-Monitor-screen-capture-300x215.png" alt="" width="300" height="215" /></a></p>
<p>And&#8230; you&#8217;re done. Enjoy.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.lassey.us/2010/09/13/android-screen-shots-without-rooting-your-phone/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

