<?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>chris' random ramblings</title>
	<atom:link href="http://atlee.ca/blog/feed/" rel="self" type="application/rss+xml" />
	<link>http://atlee.ca/blog</link>
	<description>programming, photography, media, and anything else that strikes my fancy</description>
	<lastBuildDate>Fri, 27 Jan 2012 19:08:20 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>How RelEng uses mercurial quickly and safely</title>
		<link>http://atlee.ca/blog/2012/01/27/hg-quick-and-safe/</link>
		<comments>http://atlee.ca/blog/2012/01/27/hg-quick-and-safe/#comments</comments>
		<pubDate>Fri, 27 Jan 2012 19:08:20 +0000</pubDate>
		<dc:creator>chris</dc:creator>
				<category><![CDATA[Mozilla]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://atlee.ca/blog/?p=1069</guid>
		<description><![CDATA[Release Engineering uses hg a lot. Every build or test involves code from at least one hg repository. Last year we started using some internal mirrors at the same time as making use of the hg share extension across the board, both of these had a big impact on the load on hg and time [...]]]></description>
			<content:encoded><![CDATA[<p>Release Engineering uses hg <strong>a lot</strong>. Every build or test involves code from at least one hg repository.</p>
<p><a href="http://atlee.ca/blog/2011/11/22/a-small-battle-won-in-the-war-on-build-times/">Last year</a> we started using some internal mirrors at the same time as making use of the hg share extension across the board, both of these had a big impact on the load on hg and time to clone/update local working copies.</p>
<p>I think what we&#8217;ve done is pretty useful and resilient to various types of failure, so I hope this blog post is helpful for others trying to automate processes involving hg!</p>
<p>The primary tool we&#8217;re using for hg operations is called <a href="http://hg.mozilla.org/build/tools/file/437cce872cb7/buildfarm/utils/hgtool.py">hgtool</a> (available from our <a href="http://hg.mozilla.org/build/tools">tools repo</a>). Yes, we&#8217;re very inventive at naming things.</p>
<p>hgtool&#8217;s basic usage is to be given the location of a remote repository, a local directory, and usually a revision. Its job is to make sure that the local directory contains a clean working copy of the repository at the specified revision.</p>
<p>First of all, you don&#8217;t need to worry about doing an &#8216;hg clone&#8217; if the directory doesn&#8217;t exist, or &#8216;hg pull&#8217; if it does exist. This simplifies a lot of build logic!</p>
<p>Next, we&#8217;ve build support for mirrors into hgtool. You can pass one or more mirror repositories to the tool with &#8216;&#8211;mirror&#8217;, and it will attempt to pull/clone from the mirrors before trying to pull/clone from the primary repository. At Mozilla we have several internal hg mirrors that we use to reduce load on the primary public-facing hg servers.</p>
<p>To improve the case when you need to do a full clone, we&#8217;ve added support for importing an hg bundle to initialize the local repository rather than doing a full clone from the mirror or master repositories. You can pass one or more bundle urls with &#8216;&#8211;bundle&#8217;. hgtool will download and import the bundle, and then pull in new changesets from the mirrors and master repositories.</p>
<p>Finally, hgtool supports the &#8216;hg share&#8217; extension. If you specify a base directory for shared repositories, all of the above operations will be run on a locally shared repository first, and then the working copy will be created with &#8216;hg share&#8217;, and updated to the correct revision.</p>
<p>There are all kinds of fallback behaviours specified, like if you fail to import a bundle, try to clone from a mirror; then if you fail to clone from a mirror, try to clone from the master. These fallbacks have resulted in a far more resilient build process.</p>
]]></content:encoded>
			<wfw:commentRss>http://atlee.ca/blog/2012/01/27/hg-quick-and-safe/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Book Review: A Meaningful World</title>
		<link>http://atlee.ca/blog/2012/01/17/book-review-a-meaningful-world/</link>
		<comments>http://atlee.ca/blog/2012/01/17/book-review-a-meaningful-world/#comments</comments>
		<pubDate>Wed, 18 Jan 2012 03:14:40 +0000</pubDate>
		<dc:creator>chris</dc:creator>
				<category><![CDATA[Books]]></category>

		<guid isPermaLink="false">http://atlee.ca/blog/?p=1063</guid>
		<description><![CDATA[A Meaningful World: How the Arts And Sciences Reveal the Genius of Nature. My rating: 4 of 5 stars A Meaningful World shows how our universe is fundamentally meaningful. Benjamin Wiker and Jonathan Witt demonstrate this by exploring various aspects of the human experience and human genius. The chapters dealing with Shakespeare, Euclid as well [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.goodreads.com/book/show/373340.A_Meaningful_World" style="float: left; padding-right: 20px"><img alt="A Meaningful World: How the Arts And Sciences Reveal the Genius of Nature" border="0" src="http://photo.goodreads.com/books/1295408144m/373340.jpg" /></a><a href="http://www.goodreads.com/book/show/373340.A_Meaningful_World">A Meaningful World: How the Arts And Sciences Reveal the Genius of Nature</a>.<br />
My rating: <a href="http://www.goodreads.com/review/show/240030002">4 of 5 stars</a></p>
<p><a href="http://www.goodreads.com/book/show/373340.A_Meaningful_World_How_the_Arts_And_Sciences_Reveal_the_Genius_of_Nature" title="A Meaningful World  How the Arts And Sciences Reveal the Genius of Nature by Benjamin Wiker"> A Meaningful World</a> shows how our universe is fundamentally <em>meaningful</em>. <a href="http://www.goodreads.com/author/show/100106.Benjamin_Wiker" title="Benjamin Wiker">Benjamin Wiker</a> and <a href="http://www.goodreads.com/author/show/3986280.Jonathan_Witt" title="Jonathan Witt">Jonathan Witt</a> demonstrate this by exploring various aspects of the human experience and human genius.</p>
<p>The chapters dealing with Shakespeare, Euclid as well as the chapters about the history of the periodic table of elements were particularly enjoyable.</p>
<p>One great side benefit of reading this book is a wealth of references to other great books to read!</p>
<p><a href="http://www.goodreads.com/review/list/7054040-chris-atlee">View all my reviews</a></p>
]]></content:encoded>
			<wfw:commentRss>http://atlee.ca/blog/2012/01/17/book-review-a-meaningful-world/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>What happens when you push &#8211; 2012 edition</title>
		<link>http://atlee.ca/blog/2012/01/13/what-happens-when-you-push-2012-edition/</link>
		<comments>http://atlee.ca/blog/2012/01/13/what-happens-when-you-push-2012-edition/#comments</comments>
		<pubDate>Fri, 13 Jan 2012 19:29:15 +0000</pubDate>
		<dc:creator>chris</dc:creator>
				<category><![CDATA[Mozilla]]></category>

		<guid isPermaLink="false">http://atlee.ca/blog/?p=1051</guid>
		<description><![CDATA[Once upon a time, in 2009, I described what kind of things happened when you push to mozilla-central. At the time, we would trigger 111 distinct jobs that took over 40 hours of total compute time per push. How do things look now, at the beginning of 2012? We&#8217;ve more than doubled the number of [...]]]></description>
			<content:encoded><![CDATA[<p>Once upon a time, <a href="http://atlee.ca/blog/2009/11/02/what-happens-when-you-push/">in 2009</a>, I described what kind of things happened when you push to mozilla-central. At the time, we would trigger 111 distinct jobs that took over 40 hours of total compute time per push. How do things look now, at the beginning of 2012?</p>
<p>We&#8217;ve more than doubled the number of jobs to <strong>295 distinct jobs per push</strong>, and nearly tripled the amount of compute time spent to <strong>110 hours per push!</strong></p>
<p>Here&#8217;s the complete list of stuff that happens:</p>
<table>
<tr>
<td>
<ul>
<li>Android Debug mozilla-central build</li>
</ul>
<ul>
<li>Android XUL mozilla-central build</li>
<ul>
<li>Android XUL Tegra 250 mozilla-central opt test browser-chrome</li>
<li>Android XUL Tegra 250 mozilla-central opt test crashtest-1</li>
<li>Android XUL Tegra 250 mozilla-central opt test crashtest-2</li>
<li>Android XUL Tegra 250 mozilla-central opt test jsreftest-1</li>
<li>Android XUL Tegra 250 mozilla-central opt test jsreftest-2</li>
<li>Android XUL Tegra 250 mozilla-central opt test jsreftest-3</li>
<li>Android XUL Tegra 250 mozilla-central opt test mochitest-1</li>
<li>Android XUL Tegra 250 mozilla-central opt test mochitest-2</li>
<li>Android XUL Tegra 250 mozilla-central opt test mochitest-3</li>
<li>Android XUL Tegra 250 mozilla-central opt test mochitest-4</li>
<li>Android XUL Tegra 250 mozilla-central opt test mochitest-5</li>
<li>Android XUL Tegra 250 mozilla-central opt test mochitest-6</li>
<li>Android XUL Tegra 250 mozilla-central opt test mochitest-7</li>
<li>Android XUL Tegra 250 mozilla-central opt test mochitest-8</li>
<li>Android XUL Tegra 250 mozilla-central opt test reftest-1</li>
<li>Android XUL Tegra 250 mozilla-central opt test reftest-2</li>
<li>Android XUL Tegra 250 mozilla-central opt test reftest-3</li>
<li>Android XUL Tegra 250 mozilla-central talos remote-tdhtml</li>
<li>Android XUL Tegra 250 mozilla-central talos remote-tp4m</li>
<li>Android XUL Tegra 250 mozilla-central talos remote-tp4m_nochrome</li>
<li>Android XUL Tegra 250 mozilla-central talos remote-tpan</li>
<li>Android XUL Tegra 250 mozilla-central talos remote-ts</li>
<li>Android XUL Tegra 250 mozilla-central talos remote-tsspider</li>
<li>Android XUL Tegra 250 mozilla-central talos remote-tsvg</li>
<li>Android XUL Tegra 250 mozilla-central talos remote-twinopen</li>
<li>Android XUL Tegra 250 mozilla-central talos remote-tzoom</li>
</ul>
</ul>
</td>
<td>
<ul>
<li>Android mozilla-central build</li>
<ul>
<li>Android Tegra 250 mozilla-central opt test browser-chrome</li>
<li>Android Tegra 250 mozilla-central opt test crashtest-1</li>
<li>Android Tegra 250 mozilla-central opt test crashtest-2</li>
<li>Android Tegra 250 mozilla-central opt test jsreftest-1</li>
<li>Android Tegra 250 mozilla-central opt test jsreftest-2</li>
<li>Android Tegra 250 mozilla-central opt test jsreftest-3</li>
<li>Android Tegra 250 mozilla-central opt test mochitest-1</li>
<li>Android Tegra 250 mozilla-central opt test mochitest-2</li>
<li>Android Tegra 250 mozilla-central opt test mochitest-3</li>
<li>Android Tegra 250 mozilla-central opt test mochitest-4</li>
<li>Android Tegra 250 mozilla-central opt test mochitest-5</li>
<li>Android Tegra 250 mozilla-central opt test mochitest-6</li>
<li>Android Tegra 250 mozilla-central opt test mochitest-7</li>
<li>Android Tegra 250 mozilla-central opt test mochitest-8</li>
<li>Android Tegra 250 mozilla-central opt test reftest-1</li>
<li>Android Tegra 250 mozilla-central opt test reftest-2</li>
<li>Android Tegra 250 mozilla-central opt test reftest-3</li>
<li>Android Tegra 250 mozilla-central talos remote-tdhtml</li>
<li>Android Tegra 250 mozilla-central talos remote-tp4m_nochrome</li>
<li>Android Tegra 250 mozilla-central talos remote-ts</li>
<li>Android Tegra 250 mozilla-central talos remote-tsspider</li>
<li>Android Tegra 250 mozilla-central talos remote-tsvg</li>
<li>Android Tegra 250 mozilla-central talos remote-twinopen</li>
</ul>
</ul>
</td>
</tr>
<tr>
<td>
<ul>
<li>Linux QT mozilla-central build</li>
</ul>
<ul>
<li>Linux mozilla-central build</li>
<ul>
<li>Rev3 Fedora 12 mozilla-central opt test crashtest</li>
<li>Rev3 Fedora 12 mozilla-central opt test crashtest-ipc</li>
<li>Rev3 Fedora 12 mozilla-central opt test jetpack</li>
<li>Rev3 Fedora 12 mozilla-central opt test jsreftest</li>
<li>Rev3 Fedora 12 mozilla-central opt test mochitest-other</li>
<li>Rev3 Fedora 12 mozilla-central opt test mochitests-1/5</li>
<li>Rev3 Fedora 12 mozilla-central opt test mochitests-2/5</li>
<li>Rev3 Fedora 12 mozilla-central opt test mochitests-3/5</li>
<li>Rev3 Fedora 12 mozilla-central opt test mochitests-4/5</li>
<li>Rev3 Fedora 12 mozilla-central opt test mochitests-5/5</li>
<li>Rev3 Fedora 12 mozilla-central opt test reftest</li>
<li>Rev3 Fedora 12 mozilla-central opt test reftest-ipc</li>
<li>Rev3 Fedora 12 mozilla-central opt test reftest-no-accel</li>
<li>Rev3 Fedora 12 mozilla-central opt test xpcshell</li>
<li>Rev3 Fedora 12 mozilla-central talos chrome</li>
<li>Rev3 Fedora 12 mozilla-central talos dirty</li>
<li>Rev3 Fedora 12 mozilla-central talos dromaeo</li>
<li>Rev3 Fedora 12 mozilla-central talos nochrome</li>
<li>Rev3 Fedora 12 mozilla-central talos svg</li>
<li>Rev3 Fedora 12 mozilla-central talos tp_responsiveness</li>
</ul>
</ul>
</td>
<td>
<ul>
<li>Linux mozilla-central leak test build</li>
<ul>
<li>Rev3 Fedora 12 mozilla-central debug test crashtest</li>
<li>Rev3 Fedora 12 mozilla-central debug test jetpack</li>
<li>Rev3 Fedora 12 mozilla-central debug test jsreftest</li>
<li>Rev3 Fedora 12 mozilla-central debug test mochitest-other</li>
<li>Rev3 Fedora 12 mozilla-central debug test mochitests-1/5</li>
<li>Rev3 Fedora 12 mozilla-central debug test mochitests-2/5</li>
<li>Rev3 Fedora 12 mozilla-central debug test mochitests-3/5</li>
<li>Rev3 Fedora 12 mozilla-central debug test mochitests-4/5</li>
<li>Rev3 Fedora 12 mozilla-central debug test mochitests-5/5</li>
<li>Rev3 Fedora 12 mozilla-central debug test reftest</li>
<li>Rev3 Fedora 12 mozilla-central debug test xpcshell</li>
</ul>
</ul>
</td>
</tr>
<tr>
<td>
<ul>
<li>Linux x86-64 mozilla-central build</li>
<ul>
<li>Rev3 Fedora 12&#215;64 mozilla-central opt test crashtest</li>
<li>Rev3 Fedora 12&#215;64 mozilla-central opt test jetpack</li>
<li>Rev3 Fedora 12&#215;64 mozilla-central opt test jsreftest</li>
<li>Rev3 Fedora 12&#215;64 mozilla-central opt test mochitest-other</li>
<li>Rev3 Fedora 12&#215;64 mozilla-central opt test mochitests-1/5</li>
<li>Rev3 Fedora 12&#215;64 mozilla-central opt test mochitests-2/5</li>
<li>Rev3 Fedora 12&#215;64 mozilla-central opt test mochitests-3/5</li>
<li>Rev3 Fedora 12&#215;64 mozilla-central opt test mochitests-4/5</li>
<li>Rev3 Fedora 12&#215;64 mozilla-central opt test mochitests-5/5</li>
<li>Rev3 Fedora 12&#215;64 mozilla-central opt test reftest</li>
<li>Rev3 Fedora 12&#215;64 mozilla-central opt test xpcshell</li>
<li>Rev3 Fedora 12&#215;64 mozilla-central talos chrome</li>
<li>Rev3 Fedora 12&#215;64 mozilla-central talos dirty</li>
<li>Rev3 Fedora 12&#215;64 mozilla-central talos dromaeo</li>
<li>Rev3 Fedora 12&#215;64 mozilla-central talos nochrome</li>
<li>Rev3 Fedora 12&#215;64 mozilla-central talos svg</li>
<li>Rev3 Fedora 12&#215;64 mozilla-central talos tp_responsiveness</li>
</ul>
</ul>
</td>
<td>
<ul>
<li>Linux x86-64 mozilla-central leak test build</li>
<ul>
<li>Rev3 Fedora 12&#215;64 mozilla-central debug test crashtest</li>
<li>Rev3 Fedora 12&#215;64 mozilla-central debug test jetpack</li>
<li>Rev3 Fedora 12&#215;64 mozilla-central debug test jsreftest</li>
<li>Rev3 Fedora 12&#215;64 mozilla-central debug test mochitest-other</li>
<li>Rev3 Fedora 12&#215;64 mozilla-central debug test mochitests-1/5</li>
<li>Rev3 Fedora 12&#215;64 mozilla-central debug test mochitests-2/5</li>
<li>Rev3 Fedora 12&#215;64 mozilla-central debug test mochitests-3/5</li>
<li>Rev3 Fedora 12&#215;64 mozilla-central debug test mochitests-4/5</li>
<li>Rev3 Fedora 12&#215;64 mozilla-central debug test mochitests-5/5</li>
<li>Rev3 Fedora 12&#215;64 mozilla-central debug test reftest</li>
<li>Rev3 Fedora 12&#215;64 mozilla-central debug test xpcshell</li>
</ul>
</ul>
</td>
</tr>
<tr>
<td>
<ul>
<li>OS X 10.5.2 mozilla-central leak test build</li>
<ul>
<li>Rev3 MacOSX Leopard 10.5.8 mozilla-central debug test crashtest</li>
<li>Rev3 MacOSX Leopard 10.5.8 mozilla-central debug test jetpack</li>
<li>Rev3 MacOSX Leopard 10.5.8 mozilla-central debug test jsreftest</li>
<li>Rev3 MacOSX Leopard 10.5.8 mozilla-central debug test mochitest-other</li>
<li>Rev3 MacOSX Leopard 10.5.8 mozilla-central debug test mochitests-1/5</li>
<li>Rev3 MacOSX Leopard 10.5.8 mozilla-central debug test mochitests-2/5</li>
<li>Rev3 MacOSX Leopard 10.5.8 mozilla-central debug test mochitests-3/5</li>
<li>Rev3 MacOSX Leopard 10.5.8 mozilla-central debug test mochitests-4/5</li>
<li>Rev3 MacOSX Leopard 10.5.8 mozilla-central debug test mochitests-5/5</li>
<li>Rev3 MacOSX Leopard 10.5.8 mozilla-central debug test reftest</li>
<li>Rev3 MacOSX Leopard 10.5.8 mozilla-central debug test xpcshell</li>
</ul>
</ul>
</td>
</tr>
<tr>
<td>
<ul>
<li>OS X 10.6.2 mozilla-central build</li>
<ul>
<li>Rev3 MacOSX Leopard 10.5.8 mozilla-central opt test crashtest</li>
<li>Rev3 MacOSX Leopard 10.5.8 mozilla-central opt test jetpack</li>
<li>Rev3 MacOSX Leopard 10.5.8 mozilla-central opt test jsreftest</li>
<li>Rev3 MacOSX Leopard 10.5.8 mozilla-central opt test mochitest-other</li>
<li>Rev3 MacOSX Leopard 10.5.8 mozilla-central opt test mochitests-1/5</li>
<li>Rev3 MacOSX Leopard 10.5.8 mozilla-central opt test mochitests-2/5</li>
<li>Rev3 MacOSX Leopard 10.5.8 mozilla-central opt test mochitests-3/5</li>
<li>Rev3 MacOSX Leopard 10.5.8 mozilla-central opt test mochitests-4/5</li>
<li>Rev3 MacOSX Leopard 10.5.8 mozilla-central opt test mochitests-5/5</li>
<li>Rev3 MacOSX Leopard 10.5.8 mozilla-central opt test reftest</li>
<li>Rev3 MacOSX Leopard 10.5.8 mozilla-central opt test xpcshell</li>
<li>Rev3 MacOSX Leopard 10.5.8 mozilla-central talos chrome_mac</li>
<li>Rev3 MacOSX Leopard 10.5.8 mozilla-central talos dirty</li>
<li>Rev3 MacOSX Leopard 10.5.8 mozilla-central talos dromaeo</li>
<li>Rev3 MacOSX Leopard 10.5.8 mozilla-central talos nochrome</li>
<li>Rev3 MacOSX Leopard 10.5.8 mozilla-central talos svg</li>
<li>Rev3 MacOSX Leopard 10.5.8 mozilla-central talos tp_responsiveness</li>
<li>Rev4 MacOSX Snow Leopard 10.6 mozilla-central opt test crashtest</li>
<li>Rev4 MacOSX Snow Leopard 10.6 mozilla-central opt test jetpack</li>
<li>Rev4 MacOSX Snow Leopard 10.6 mozilla-central opt test jsreftest</li>
<li>Rev4 MacOSX Snow Leopard 10.6 mozilla-central opt test mochitest-other</li>
<li>Rev4 MacOSX Snow Leopard 10.6 mozilla-central opt test mochitests-1/5</li>
<li>Rev4 MacOSX Snow Leopard 10.6 mozilla-central opt test mochitests-2/5</li>
<li>Rev4 MacOSX Snow Leopard 10.6 mozilla-central opt test mochitests-3/5</li>
<li>Rev4 MacOSX Snow Leopard 10.6 mozilla-central opt test mochitests-4/5</li>
<li>Rev4 MacOSX Snow Leopard 10.6 mozilla-central opt test mochitests-5/5</li>
<li>Rev4 MacOSX Snow Leopard 10.6 mozilla-central opt test reftest</li>
<li>Rev4 MacOSX Snow Leopard 10.6 mozilla-central opt test xpcshell</li>
<li>Rev4 MacOSX Snow Leopard 10.6 mozilla-central talos chrome_mac</li>
<li>Rev4 MacOSX Snow Leopard 10.6 mozilla-central talos dirty</li>
<li>Rev4 MacOSX Snow Leopard 10.6 mozilla-central talos dromaeo</li>
<li>Rev4 MacOSX Snow Leopard 10.6 mozilla-central talos nochrome</li>
<li>Rev4 MacOSX Snow Leopard 10.6 mozilla-central talos svg</li>
<li>Rev4 MacOSX Snow Leopard 10.6 mozilla-central talos tp_responsiveness</li>
<li>Rev4 MacOSX Lion 10.7 mozilla-central opt test crashtest</li>
<li>Rev4 MacOSX Lion 10.7 mozilla-central opt test jetpack</li>
<li>Rev4 MacOSX Lion 10.7 mozilla-central opt test jsreftest</li>
<li>Rev4 MacOSX Lion 10.7 mozilla-central opt test mochitest-other</li>
<li>Rev4 MacOSX Lion 10.7 mozilla-central opt test mochitests-1/5</li>
<li>Rev4 MacOSX Lion 10.7 mozilla-central opt test mochitests-2/5</li>
<li>Rev4 MacOSX Lion 10.7 mozilla-central opt test mochitests-3/5</li>
<li>Rev4 MacOSX Lion 10.7 mozilla-central opt test mochitests-4/5</li>
<li>Rev4 MacOSX Lion 10.7 mozilla-central opt test mochitests-5/5</li>
<li>Rev4 MacOSX Lion 10.7 mozilla-central opt test reftest</li>
<li>Rev4 MacOSX Lion 10.7 mozilla-central opt test xpcshell</li>
<li>Rev4 MacOSX Lion 10.7 mozilla-central talos chrome_mac</li>
<li>Rev4 MacOSX Lion 10.7 mozilla-central talos dirty</li>
<li>Rev4 MacOSX Lion 10.7 mozilla-central talos dromaeo</li>
<li>Rev4 MacOSX Lion 10.7 mozilla-central talos nochrome</li>
<li>Rev4 MacOSX Lion 10.7 mozilla-central talos svg</li>
<li>Rev4 MacOSX Lion 10.7 mozilla-central talos tp_responsiveness</li>
</ul>
</ul>
</td>
<td>
<ul>
<li>OS X 10.6.2 mozilla-central leak test build</li>
<ul>
<li>Rev4 MacOSX Snow Leopard 10.6 mozilla-central debug test crashtest</li>
<li>Rev4 MacOSX Snow Leopard 10.6 mozilla-central debug test jetpack</li>
<li>Rev4 MacOSX Snow Leopard 10.6 mozilla-central debug test jsreftest</li>
<li>Rev4 MacOSX Snow Leopard 10.6 mozilla-central debug test mochitest-other</li>
<li>Rev4 MacOSX Snow Leopard 10.6 mozilla-central debug test mochitests-1/5</li>
<li>Rev4 MacOSX Snow Leopard 10.6 mozilla-central debug test mochitests-2/5</li>
<li>Rev4 MacOSX Snow Leopard 10.6 mozilla-central debug test mochitests-3/5</li>
<li>Rev4 MacOSX Snow Leopard 10.6 mozilla-central debug test mochitests-4/5</li>
<li>Rev4 MacOSX Snow Leopard 10.6 mozilla-central debug test mochitests-5/5</li>
<li>Rev4 MacOSX Snow Leopard 10.6 mozilla-central debug test reftest</li>
<li>Rev4 MacOSX Snow Leopard 10.6 mozilla-central debug test xpcshell</li>
<li>Rev4 MacOSX Lion 10.7 mozilla-central debug test crashtest</li>
<li>Rev4 MacOSX Lion 10.7 mozilla-central debug test jetpack</li>
<li>Rev4 MacOSX Lion 10.7 mozilla-central debug test jsreftest</li>
<li>Rev4 MacOSX Lion 10.7 mozilla-central debug test mochitest-other</li>
<li>Rev4 MacOSX Lion 10.7 mozilla-central debug test mochitests-1/5</li>
<li>Rev4 MacOSX Lion 10.7 mozilla-central debug test mochitests-2/5</li>
<li>Rev4 MacOSX Lion 10.7 mozilla-central debug test mochitests-3/5</li>
<li>Rev4 MacOSX Lion 10.7 mozilla-central debug test mochitests-4/5</li>
<li>Rev4 MacOSX Lion 10.7 mozilla-central debug test mochitests-5/5</li>
<li>Rev4 MacOSX Lion 10.7 mozilla-central debug test reftest</li>
<li>Rev4 MacOSX Lion 10.7 mozilla-central debug test xpcshell</li>
</ul>
</ul>
</td>
</tr>
<tr>
<td>
<ul>
<li>WINNT 5.2 mozilla-central build</li>
<ul>
<li>Rev3 WINNT 5.1 mozilla-central opt test crashtest</li>
<li>Rev3 WINNT 5.1 mozilla-central opt test jetpack</li>
<li>Rev3 WINNT 5.1 mozilla-central opt test jsreftest</li>
<li>Rev3 WINNT 5.1 mozilla-central opt test mochitest-other</li>
<li>Rev3 WINNT 5.1 mozilla-central opt test mochitests-1/5</li>
<li>Rev3 WINNT 5.1 mozilla-central opt test mochitests-2/5</li>
<li>Rev3 WINNT 5.1 mozilla-central opt test mochitests-3/5</li>
<li>Rev3 WINNT 5.1 mozilla-central opt test mochitests-4/5</li>
<li>Rev3 WINNT 5.1 mozilla-central opt test mochitests-5/5</li>
<li>Rev3 WINNT 5.1 mozilla-central opt test reftest</li>
<li>Rev3 WINNT 5.1 mozilla-central opt test xpcshell</li>
<li>Rev3 WINNT 5.1 mozilla-central talos chrome</li>
<li>Rev3 WINNT 5.1 mozilla-central talos dirty</li>
<li>Rev3 WINNT 5.1 mozilla-central talos dromaeo</li>
<li>Rev3 WINNT 5.1 mozilla-central talos nochrome</li>
<li>Rev3 WINNT 5.1 mozilla-central talos svg</li>
<li>Rev3 WINNT 5.1 mozilla-central talos tp_responsiveness</li>
<li>Rev3 WINNT 6.1 mozilla-central opt test crashtest</li>
<li>Rev3 WINNT 6.1 mozilla-central opt test jetpack</li>
<li>Rev3 WINNT 6.1 mozilla-central opt test jsreftest</li>
<li>Rev3 WINNT 6.1 mozilla-central opt test mochitest-other</li>
<li>Rev3 WINNT 6.1 mozilla-central opt test mochitests-1/5</li>
<li>Rev3 WINNT 6.1 mozilla-central opt test mochitests-2/5</li>
<li>Rev3 WINNT 6.1 mozilla-central opt test mochitests-3/5</li>
<li>Rev3 WINNT 6.1 mozilla-central opt test mochitests-4/5</li>
<li>Rev3 WINNT 6.1 mozilla-central opt test mochitests-5/5</li>
<li>Rev3 WINNT 6.1 mozilla-central opt test reftest</li>
<li>Rev3 WINNT 6.1 mozilla-central opt test xpcshell</li>
<li>Rev3 WINNT 6.1 mozilla-central talos chrome</li>
<li>Rev3 WINNT 6.1 mozilla-central talos dirty</li>
<li>Rev3 WINNT 6.1 mozilla-central talos dromaeo</li>
<li>Rev3 WINNT 6.1 mozilla-central talos nochrome</li>
<li>Rev3 WINNT 6.1 mozilla-central talos svg</li>
<li>Rev3 WINNT 6.1 mozilla-central talos tp_responsiveness</li>
<li>Rev3 WINNT 6.1 mozilla-central talos xperf</li>
</ul>
</ul>
</td>
<td>
<ul>
<li>WINNT 5.2 mozilla-central leak test build</li>
<ul>
<li>Rev3 WINNT 5.1 mozilla-central debug test crashtest</li>
<li>Rev3 WINNT 5.1 mozilla-central debug test jetpack</li>
<li>Rev3 WINNT 5.1 mozilla-central debug test jsreftest</li>
<li>Rev3 WINNT 5.1 mozilla-central debug test mochitest-other</li>
<li>Rev3 WINNT 5.1 mozilla-central debug test mochitests-1/5</li>
<li>Rev3 WINNT 5.1 mozilla-central debug test mochitests-2/5</li>
<li>Rev3 WINNT 5.1 mozilla-central debug test mochitests-3/5</li>
<li>Rev3 WINNT 5.1 mozilla-central debug test mochitests-4/5</li>
<li>Rev3 WINNT 5.1 mozilla-central debug test mochitests-5/5</li>
<li>Rev3 WINNT 5.1 mozilla-central debug test reftest</li>
<li>Rev3 WINNT 5.1 mozilla-central debug test xpcshell</li>
<li>Rev3 WINNT 6.1 mozilla-central debug test crashtest</li>
<li>Rev3 WINNT 6.1 mozilla-central debug test jetpack</li>
<li>Rev3 WINNT 6.1 mozilla-central debug test jsreftest</li>
<li>Rev3 WINNT 6.1 mozilla-central debug test mochitest-other</li>
<li>Rev3 WINNT 6.1 mozilla-central debug test mochitests-1/5</li>
<li>Rev3 WINNT 6.1 mozilla-central debug test mochitests-2/5</li>
<li>Rev3 WINNT 6.1 mozilla-central debug test mochitests-3/5</li>
<li>Rev3 WINNT 6.1 mozilla-central debug test mochitests-4/5</li>
<li>Rev3 WINNT 6.1 mozilla-central debug test mochitests-5/5</li>
<li>Rev3 WINNT 6.1 mozilla-central debug test reftest</li>
<li>Rev3 WINNT 6.1 mozilla-central debug test xpcshell</li>
</ul>
</ul>
</td>
</tr>
<tr>
<td>
<ul>
<li>WINNT 6.1 x86-64 mozilla-central build</li>
<ul>
<li>Rev3 WINNT 6.1 x64 mozilla-central opt test crashtest</li>
<li>Rev3 WINNT 6.1 x64 mozilla-central opt test jetpack</li>
<li>Rev3 WINNT 6.1 x64 mozilla-central opt test jsreftest</li>
<li>Rev3 WINNT 6.1 x64 mozilla-central opt test mochitest-other</li>
<li>Rev3 WINNT 6.1 x64 mozilla-central opt test mochitests-1/5</li>
<li>Rev3 WINNT 6.1 x64 mozilla-central opt test mochitests-2/5</li>
<li>Rev3 WINNT 6.1 x64 mozilla-central opt test mochitests-3/5</li>
<li>Rev3 WINNT 6.1 x64 mozilla-central opt test mochitests-4/5</li>
<li>Rev3 WINNT 6.1 x64 mozilla-central opt test mochitests-5/5</li>
<li>Rev3 WINNT 6.1 x64 mozilla-central opt test reftest</li>
<li>Rev3 WINNT 6.1 x64 mozilla-central opt test xpcshell</li>
<li>Rev3 WINNT 6.1 x64 mozilla-central talos chrome</li>
<li>Rev3 WINNT 6.1 x64 mozilla-central talos dirty</li>
<li>Rev3 WINNT 6.1 x64 mozilla-central talos dromaeo</li>
<li>Rev3 WINNT 6.1 x64 mozilla-central talos nochrome</li>
<li>Rev3 WINNT 6.1 x64 mozilla-central talos svg</li>
</ul>
</ul>
</td>
<td>
<ul>
<li>jetpack-mozilla-central-fedora-debug</li>
<li>jetpack-mozilla-central-fedora-opt</li>
<li>jetpack-mozilla-central-fedora64-debug</li>
<li>jetpack-mozilla-central-fedora64-opt</li>
<li>jetpack-mozilla-central-leopard-debug</li>
<li>jetpack-mozilla-central-leopard-opt</li>
<li>jetpack-mozilla-central-lion-debug</li>
<li>jetpack-mozilla-central-lion-opt</li>
<li>jetpack-mozilla-central-snowleopard-debug</li>
<li>jetpack-mozilla-central-snowleopard-opt</li>
<li>jetpack-mozilla-central-w764-debug</li>
<li>jetpack-mozilla-central-w764-opt</li>
<li>jetpack-mozilla-central-win7-debug</li>
<li>jetpack-mozilla-central-win7-opt</li>
<li>jetpack-mozilla-central-xp-debug</li>
<li>jetpack-mozilla-central-xp-opt</li>
</ul>
</td>
</tr>
</table>
]]></content:encoded>
			<wfw:commentRss>http://atlee.ca/blog/2012/01/13/what-happens-when-you-push-2012-edition/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Investigating hg performance</title>
		<link>http://atlee.ca/blog/2011/12/09/hg-performance/</link>
		<comments>http://atlee.ca/blog/2011/12/09/hg-performance/#comments</comments>
		<pubDate>Fri, 09 Dec 2011 07:02:28 +0000</pubDate>
		<dc:creator>chris</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Mozilla]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[performance]]></category>

		<guid isPermaLink="false">http://atlee.ca/blog/?p=1035</guid>
		<description><![CDATA[(caveat lector: this is a long post with lots of shell snippets and output; it&#8217;s mostly a brain dump of what I did to investigate performance issues on hg.mozilla.org. I hope you find it useful. Scroll to the bottom for the summary.) Everybody knows that pushing to try can be slow. but why? while waiting [...]]]></description>
			<content:encoded><![CDATA[<p><em>(caveat lector: this is a long post with lots of shell snippets and output; it&#8217;s mostly a brain dump of what I did to investigate performance issues on hg.mozilla.org. I hope you find it useful. Scroll to the bottom for the summary.)</em></p>
<p><a href="https://bugzilla.mozilla.org/show_bug.cgi?id=656757">Everybody</a> <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=676420">knows</a> <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=554656">that</a> <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=708632">pushing</a> <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=688240">to</a> <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=695454">try</a> <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=696682">can</a> <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=672231">be</a> <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=633161">slow</a>. but why?</p>
<p>while waiting for my push to try to complete, I wondered what exactly was slow.</p>
<p>I started by cloning my own version of try:</p>
<pre>
$ hg clone http://hg.mozilla.org try
destination directory: try
requesting all changes
adding changesets
adding manifests
adding file changes
added 95917 changesets with 447521 changes to 89564 files (+2446 heads)
updating to branch default
53650 files updated, 0 files merged, 0 files removed, 0 files unresolved
</pre>
<p>Next I instrumented hg so I could get some profile information:</p>
<pre>
$ sudo vi /usr/local/bin/hg
python -m cProfile -o /tmp/hg.profile /usr/bin/hg $*
</pre>
<p>Then I timed out long it took me to check what would be pushed:</p>
<pre>
$ time hg out ssh://localhost//home/catlee/mozilla/try
hg out ssh://localhost//home/catlee/mozilla/try  0.57s user 0.04s system 54% cpu 1.114 total
</pre>
<p>That&#8217;s not too bad. Let&#8217;s check our profile:</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;"><span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">pstats</span>
<span style="color: #dc143c;">pstats</span>.<span style="color: black;">Stats</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;/tmp/hg.profile&quot;</span><span style="color: black;">&#41;</span>.<span style="color: black;">strip_dirs</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>.<span style="color: black;">sort_stats</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'time'</span><span style="color: black;">&#41;</span>.<span style="color: black;">print_stats</span><span style="color: black;">&#40;</span><span style="color: #ff4500;">10</span><span style="color: black;">&#41;</span>
Fri Dec  <span style="color: #ff4500;">9</span> 00:<span style="color: #ff4500;">25</span>:02 <span style="color: #ff4500;">2011</span>    /tmp/hg.<span style="color: #dc143c;">profile</span>
&nbsp;
         <span style="color: #ff4500;">38744</span> function calls <span style="color: black;">&#40;</span><span style="color: #ff4500;">37761</span> primitive calls<span style="color: black;">&#41;</span> <span style="color: #ff7700;font-weight:bold;">in</span> <span style="color: #ff4500;">0.593</span> seconds
&nbsp;
   Ordered by: internal <span style="color: #dc143c;">time</span>
   List reduced <span style="color: #ff7700;font-weight:bold;">from</span> <span style="color: #ff4500;">476</span> to <span style="color: #ff4500;">10</span> due to restriction <span style="color: #66cc66;">&lt;</span><span style="color: #ff4500;">10</span><span style="color: #66cc66;">&gt;</span>
&nbsp;
   ncalls  tottime  percall  cumtime  percall filename:lineno<span style="color: black;">&#40;</span>function<span style="color: black;">&#41;</span>
       <span style="color: #ff4500;">13</span>    <span style="color: #ff4500;">0.462</span>    <span style="color: #ff4500;">0.036</span>    <span style="color: #ff4500;">0.462</span>    <span style="color: #ff4500;">0.036</span> <span style="color: black;">&#123;</span>method <span style="color: #483d8b;">'readline'</span> of <span style="color: #483d8b;">'file'</span> objects<span style="color: black;">&#125;</span>
        <span style="color: #ff4500;">1</span>    <span style="color: #ff4500;">0.039</span>    <span style="color: #ff4500;">0.039</span>    <span style="color: #ff4500;">0.039</span>    <span style="color: #ff4500;">0.039</span> <span style="color: black;">&#123;</span>mercurial.<span style="color: black;">parsers</span>.<span style="color: black;">parse_index2</span><span style="color: black;">&#125;</span>
       <span style="color: #ff4500;">40</span>    <span style="color: #ff4500;">0.031</span>    <span style="color: #ff4500;">0.001</span>    <span style="color: #ff4500;">0.031</span>    <span style="color: #ff4500;">0.001</span> revlog.<span style="color: black;">py</span>:<span style="color: #ff4500;">291</span><span style="color: black;">&#40;</span>rev<span style="color: black;">&#41;</span>
        <span style="color: #ff4500;">1</span>    <span style="color: #ff4500;">0.019</span>    <span style="color: #ff4500;">0.019</span>    <span style="color: #ff4500;">0.019</span>    <span style="color: #ff4500;">0.019</span> revlog.<span style="color: black;">py</span>:<span style="color: #ff4500;">622</span><span style="color: black;">&#40;</span>headrevs<span style="color: black;">&#41;</span>
   <span style="color: #ff4500;">177</span>/<span style="color: #ff4500;">70</span>    <span style="color: #ff4500;">0.009</span>    <span style="color: #ff4500;">0.000</span>    <span style="color: #ff4500;">0.019</span>    <span style="color: #ff4500;">0.000</span> <span style="color: black;">&#123;</span><span style="color: #008000;">__import__</span><span style="color: black;">&#125;</span>
     <span style="color: #ff4500;">6326</span>    <span style="color: #ff4500;">0.004</span>    <span style="color: #ff4500;">0.000</span>    <span style="color: #ff4500;">0.006</span>    <span style="color: #ff4500;">0.000</span> cmdutil.<span style="color: black;">py</span>:<span style="color: #ff4500;">15</span><span style="color: black;">&#40;</span>parsealiases<span style="color: black;">&#41;</span>
       <span style="color: #ff4500;">13</span>    <span style="color: #ff4500;">0.003</span>    <span style="color: #ff4500;">0.000</span>    <span style="color: #ff4500;">0.003</span>    <span style="color: #ff4500;">0.000</span> <span style="color: black;">&#123;</span>method <span style="color: #483d8b;">'read'</span> of <span style="color: #483d8b;">'file'</span> objects<span style="color: black;">&#125;</span>
       <span style="color: #ff4500;">93</span>    <span style="color: #ff4500;">0.002</span>    <span style="color: #ff4500;">0.000</span>    <span style="color: #ff4500;">0.008</span>    <span style="color: #ff4500;">0.000</span> cmdutil.<span style="color: black;">py</span>:<span style="color: #ff4500;">18</span><span style="color: black;">&#40;</span>findpossible<span style="color: black;">&#41;</span>
     <span style="color: #ff4500;">7212</span>    <span style="color: #ff4500;">0.001</span>    <span style="color: #ff4500;">0.000</span>    <span style="color: #ff4500;">0.001</span>    <span style="color: #ff4500;">0.000</span> <span style="color: black;">&#123;</span>method <span style="color: #483d8b;">'split'</span> of <span style="color: #483d8b;">'str'</span> objects<span style="color: black;">&#125;</span>
  <span style="color: #ff4500;">392</span>/<span style="color: #ff4500;">313</span>    <span style="color: #ff4500;">0.001</span>    <span style="color: #ff4500;">0.000</span>    <span style="color: #ff4500;">0.007</span>    <span style="color: #ff4500;">0.000</span> demandimport.<span style="color: black;">py</span>:<span style="color: #ff4500;">92</span><span style="color: black;">&#40;</span>_demandimport<span style="color: black;">&#41;</span></pre></div></div>

<p>The top item is readline() on file objects? I wonder if that&#8217;s socket operations. I&#8217;m ssh&#8217;ing to localhost, so it&#8217;s really fast. Let&#8217;s add 100ms latency:</p>
<pre>
$ sudo tc qdisc add dev lo root handle 1:0 netem delay 100ms
$ time hg out ssh://localhost//home/catlee/mozilla/try
hg out ssh://localhost//home/catlee/mozilla/try  0.58s user 0.05s system 14% cpu 4.339 total
</pre>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;"><span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">pstats</span>
<span style="color: #dc143c;">pstats</span>.<span style="color: black;">Stats</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;/tmp/hg.profile&quot;</span><span style="color: black;">&#41;</span>.<span style="color: black;">strip_dirs</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>.<span style="color: black;">sort_stats</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'time'</span><span style="color: black;">&#41;</span>.<span style="color: black;">print_stats</span><span style="color: black;">&#40;</span><span style="color: #ff4500;">10</span><span style="color: black;">&#41;</span>
Fri Dec  <span style="color: #ff4500;">9</span> 00:<span style="color: #ff4500;">42</span>:09 <span style="color: #ff4500;">2011</span>    /tmp/hg.<span style="color: #dc143c;">profile</span>
&nbsp;
         <span style="color: #ff4500;">38744</span> function calls <span style="color: black;">&#40;</span><span style="color: #ff4500;">37761</span> primitive calls<span style="color: black;">&#41;</span> <span style="color: #ff7700;font-weight:bold;">in</span> <span style="color: #ff4500;">2.728</span> seconds
&nbsp;
   Ordered by: internal <span style="color: #dc143c;">time</span>
   List reduced <span style="color: #ff7700;font-weight:bold;">from</span> <span style="color: #ff4500;">476</span> to <span style="color: #ff4500;">10</span> due to restriction <span style="color: #66cc66;">&lt;</span><span style="color: #ff4500;">10</span><span style="color: #66cc66;">&gt;</span>
&nbsp;
   ncalls  tottime  percall  cumtime  percall filename:lineno<span style="color: black;">&#40;</span>function<span style="color: black;">&#41;</span>
       <span style="color: #ff4500;">13</span>    <span style="color: #ff4500;">2.583</span>    <span style="color: #ff4500;">0.199</span>    <span style="color: #ff4500;">2.583</span>    <span style="color: #ff4500;">0.199</span> <span style="color: black;">&#123;</span>method <span style="color: #483d8b;">'readline'</span> of <span style="color: #483d8b;">'file'</span> objects<span style="color: black;">&#125;</span>
        <span style="color: #ff4500;">1</span>    <span style="color: #ff4500;">0.054</span>    <span style="color: #ff4500;">0.054</span>    <span style="color: #ff4500;">0.054</span>    <span style="color: #ff4500;">0.054</span> <span style="color: black;">&#123;</span>mercurial.<span style="color: black;">parsers</span>.<span style="color: black;">parse_index2</span><span style="color: black;">&#125;</span>
       <span style="color: #ff4500;">40</span>    <span style="color: #ff4500;">0.028</span>    <span style="color: #ff4500;">0.001</span>    <span style="color: #ff4500;">0.028</span>    <span style="color: #ff4500;">0.001</span> revlog.<span style="color: black;">py</span>:<span style="color: #ff4500;">291</span><span style="color: black;">&#40;</span>rev<span style="color: black;">&#41;</span>
        <span style="color: #ff4500;">1</span>    <span style="color: #ff4500;">0.019</span>    <span style="color: #ff4500;">0.019</span>    <span style="color: #ff4500;">0.019</span>    <span style="color: #ff4500;">0.019</span> revlog.<span style="color: black;">py</span>:<span style="color: #ff4500;">622</span><span style="color: black;">&#40;</span>headrevs<span style="color: black;">&#41;</span>
   <span style="color: #ff4500;">177</span>/<span style="color: #ff4500;">70</span>    <span style="color: #ff4500;">0.010</span>    <span style="color: #ff4500;">0.000</span>    <span style="color: #ff4500;">0.019</span>    <span style="color: #ff4500;">0.000</span> <span style="color: black;">&#123;</span><span style="color: #008000;">__import__</span><span style="color: black;">&#125;</span>
       <span style="color: #ff4500;">13</span>    <span style="color: #ff4500;">0.006</span>    <span style="color: #ff4500;">0.000</span>    <span style="color: #ff4500;">0.006</span>    <span style="color: #ff4500;">0.000</span> <span style="color: black;">&#123;</span>method <span style="color: #483d8b;">'read'</span> of <span style="color: #483d8b;">'file'</span> objects<span style="color: black;">&#125;</span>
     <span style="color: #ff4500;">6326</span>    <span style="color: #ff4500;">0.002</span>    <span style="color: #ff4500;">0.000</span>    <span style="color: #ff4500;">0.004</span>    <span style="color: #ff4500;">0.000</span> cmdutil.<span style="color: black;">py</span>:<span style="color: #ff4500;">15</span><span style="color: black;">&#40;</span>parsealiases<span style="color: black;">&#41;</span>
       <span style="color: #ff4500;">93</span>    <span style="color: #ff4500;">0.002</span>    <span style="color: #ff4500;">0.000</span>    <span style="color: #ff4500;">0.006</span>    <span style="color: #ff4500;">0.000</span> cmdutil.<span style="color: black;">py</span>:<span style="color: #ff4500;">18</span><span style="color: black;">&#40;</span>findpossible<span style="color: black;">&#41;</span>
  <span style="color: #ff4500;">392</span>/<span style="color: #ff4500;">313</span>    <span style="color: #ff4500;">0.002</span>    <span style="color: #ff4500;">0.000</span>    <span style="color: #ff4500;">0.008</span>    <span style="color: #ff4500;">0.000</span> demandimport.<span style="color: black;">py</span>:<span style="color: #ff4500;">92</span><span style="color: black;">&#40;</span>_demandimport<span style="color: black;">&#41;</span>
     <span style="color: #ff4500;">7212</span>    <span style="color: #ff4500;">0.001</span>    <span style="color: #ff4500;">0.000</span>    <span style="color: #ff4500;">0.001</span>    <span style="color: #ff4500;">0.000</span> <span style="color: black;">&#123;</span>method <span style="color: #483d8b;">'split'</span> of <span style="color: #483d8b;">'str'</span> objects<span style="color: black;">&#125;</span></pre></div></div>

<p>Yep, definitely getting worse with more latency on the network connection.</p>
<p>Oh, and I&#8217;m using a recent version of hg:</p>
<pre>
$ hg --version
Mercurial Distributed SCM (version 2.0)

$ echo hello | ssh localhost hg -R /home/catlee/mozilla/try serve --stdio
145
capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch stream unbundle=HG10GZ,HG10BZ,HG10UN httpheader=1024
</pre>
<p>This doesn&#8217;t match what hg.mozilla.org is running:</p>
<pre>
$ echo hello | ssh hg.mozilla.org hg -R /mozilla-central serve --stdio
67
capabilities: unbundle lookup changegroupsubset branchmap stream=1
</pre>
<p>So it must be using an older version. Let&#8217;s see what mercurial 1.6 does:</p>
<pre>
$ mkvirtualenv hg16
New python executable in hg16/bin/python
Installing setuptools...

(hg16)$ pip install mercurial==1.6
Downloading/unpacking mercurial==1.6
  Downloading mercurial-1.6.tar.gz (2.2Mb): 2.2Mb downloaded
...

(hg16)$ hg --version
Mercurial Distributed SCM (version 1.6)

(hg16)$ echo hello | ssh localhost /home/catlee/.virtualenvs/hg16/bin/hg -R /home/catlee/mozilla/mozilla-central serve --stdio
75
capabilities: unbundle lookup changegroupsubset branchmap pushkey stream=1
</pre>
<p>That looks pretty close to what hg.mozilla.org claims it supports, so let&#8217;s time &#8216;hg out&#8217; again:</p>
<pre>
(hg16)$ time hg out ssh://localhost//home/catlee/mozilla/try
hg out ssh://localhost//home/catlee/mozilla/try  0.73s user 0.04s system 3% cpu 24.278 total
</pre>
<h1>tl;dr</h1>
<p>Finding missing changesets between two local repositories is <strong>6x slower with hg 1.6</strong> (4 seconds with hg 2.0 to 24 seconds hg 1.6). Add a few hundred people and machines hitting the same repository at the same time, and I imagine things can get bad pretty quickly.</p>
<p>Some further searching reveals that mercurial does support a <a href="http://mercurial.selenic.com/wiki/WireProtocol">faster</a> method of finding missing changesets in &#8220;newer&#8221; versions, although I can&#8217;t figure out exactly when this change was introduced.  There&#8217;s already a <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=623505">bug on file</a> for upgrading mercurial on hg.mozilla.org, so hopefully that improves the situation for pushes to try.</p>
<p>The tools we use everyday aren&#8217;t magical; they&#8217;re subject to normal debugging and profiling techniques. If a tool you&#8217;re using is holding you back, find out why!</p>
]]></content:encoded>
			<wfw:commentRss>http://atlee.ca/blog/2011/12/09/hg-performance/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Signed builds coming soon to a nightly near you!</title>
		<link>http://atlee.ca/blog/2011/12/06/signed-nightlies/</link>
		<comments>http://atlee.ca/blog/2011/12/06/signed-nightlies/#comments</comments>
		<pubDate>Tue, 06 Dec 2011 20:52:46 +0000</pubDate>
		<dc:creator>chris</dc:creator>
				<category><![CDATA[Mozilla]]></category>

		<guid isPermaLink="false">http://atlee.ca/blog/?p=1024</guid>
		<description><![CDATA[tl;dr: Starting soon (today I hope!) all nightly windows builds will be authenticode signed. Update mars will also be signed according to the new MAR format. the long version: RelEng have turned it up to 11 over the past few weeks to build up and deploy a new infrastructure to support the silent update program. [...]]]></description>
			<content:encoded><![CDATA[<p>tl;dr: Starting soon (today I hope!) all nightly windows builds will be <a href="http://msdn.microsoft.com/en-us/library/ms537361.aspx">authenticode</a> signed. Update mars will also be signed according to the <a href="https://wiki.mozilla.org/Software_Update:MAR">new MAR format</a>.</p>
<p>the long version:</p>
<p>RelEng have turned it up to 11 over the past few weeks to build up and deploy a new infrastructure to support the <a href="https://wiki.mozilla.org/Silent_Update_OS_Dialogs">silent update</a> program. One of the requirements for this project is that all binaries, including nightly builds and updates, be signed similar to how we already do signing for releases. Our current release signing process still requires some manual work, and it&#8217;s not feasible to manually sign each nightly build every day. We&#8217;ve developed systems for integrating signing into the build process so that nightly builds will be fully signed before they get uploaded to FTP for our nightly users to download. Incremental builds will also be signed using a different (self-signed) certificate.</p>
<p>Our plan is to enable signing on other platforms as soon as possible, where appropriate.</p>
<p><strong>Please</strong> let us know if you have any problems with builds or updates as a result of this.</p>
<p>Details are mostly in <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=509158">bug 509158</a>.</p>
<p>I&#8217;m very proud of my team on this, especially <a href="http://blog.mozilla.com/bhearsum/">bhearsum</a> and <a href="http://blog.mozilla.com/rail/">rail</a>. Thanks guys!</p>
<p>Now we&#8217;ll be dialing it back to 10, our normal resting state.</p>
]]></content:encoded>
			<wfw:commentRss>http://atlee.ca/blog/2011/12/06/signed-nightlies/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Christmas tree preparations with an Arduino</title>
		<link>http://atlee.ca/blog/2011/11/27/christmas-tree-preparations-with-an-arduino/</link>
		<comments>http://atlee.ca/blog/2011/11/27/christmas-tree-preparations-with-an-arduino/#comments</comments>
		<pubDate>Sun, 27 Nov 2011 23:26:18 +0000</pubDate>
		<dc:creator>chris</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[arduino]]></category>
		<category><![CDATA[christmas]]></category>

		<guid isPermaLink="false">http://atlee.ca/blog/?p=1015</guid>
		<description><![CDATA[We usually get a real Christmas tree if we&#8217;re going to be in town for Christmas. A real tree needs watering though, which is something we&#8217;ve been less than&#8230;consistent with over the past years. I decided to do something about this and build something to alert me when the water level gets too low. Two [...]]]></description>
			<content:encoded><![CDATA[<p>We usually get a real Christmas tree if we&#8217;re going to be in town for Christmas. A real tree needs watering though, which is something we&#8217;ve been less than&#8230;consistent with over the past years.</p>
<p>I decided to do something about this and build something to alert me when the water level gets too low. Two strips of aluminum foil taped to either side of a piece of plastic provide my water sensor. One strip is connected to an analog input on the arduino, and the other strip is connected to +3.3V. When the sensor is submerged I get a reading of around 300 &#8220;units&#8221; from the ADC. When it&#8217;s removed from the water, a 10k pulldown resistor brings the reading down to 0.</p>
<p>I&#8217;ve hooked up a tri-colour LED to indicate various states, and plan to have an audible alert as well.</p>
<p>I&#8217;m not sure if the aluminum will end up corroding, nor if I&#8217;ll be able to power this off batteries for any length of time. Still, I&#8217;m pretty pleased with it so far!</p>
<p><video controls="controls" src='http://atlee.ca/blog/wp-content/uploads/xmas1.webm' width="852" height="480" >Initial tests</video></p>
<p>Here you can see that LED is green when the sensor is submerged, and changes colours (like a traffic light, as per Thomas&#8217; request) when the sensor is removed.</p>
]]></content:encoded>
			<wfw:commentRss>http://atlee.ca/blog/2011/11/27/christmas-tree-preparations-with-an-arduino/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
<enclosure url="http://atlee.ca/blog/wp-content/uploads/xmas1.webm" length="1526745" type="video/webm" />
		</item>
		<item>
		<title>A small battle won in the war on build times</title>
		<link>http://atlee.ca/blog/2011/11/22/a-small-battle-won-in-the-war-on-build-times/</link>
		<comments>http://atlee.ca/blog/2011/11/22/a-small-battle-won-in-the-war-on-build-times/#comments</comments>
		<pubDate>Tue, 22 Nov 2011 18:17:31 +0000</pubDate>
		<dc:creator>chris</dc:creator>
				<category><![CDATA[Mozilla]]></category>

		<guid isPermaLink="false">http://atlee.ca/blog/?p=1005</guid>
		<description><![CDATA[On November 8th we landed some changes that changed the way we do checkouts from hg. We enabled the hg share extension on android builds and started using internal hg mirrors to pull/clone from instead of hitting the main hg.mozilla.org. The primary goal of this project was to reduce the load on the main hg [...]]]></description>
			<content:encoded><![CDATA[<p>On November 8th we landed some <a href="http://hg.mozilla.org/build/tools/rev/437cce872cb7">changes</a> that changed the way we do checkouts from hg. We enabled the hg share extension on android builds and started using internal hg mirrors to pull/clone from instead of hitting the main <a href="http://hg.mozilla.org/">hg.mozilla.org</a>.</p>
<p>The primary goal of this project was to reduce the load on the main hg server where developers often experience interrupted clones or slow pushes. If things got faster as a result, that would be a bonus.</p>
<p>I&#8217;m pretty happy with the impact on checkout times, especially on try android builds!<br />
<a href="http://atlee.ca/blog/wp-content/uploads/chart_12.png"><img src="http://atlee.ca/blog/wp-content/uploads/chart_12.png" alt="" title="update times" width="600" height="371" class="alignnone size-full wp-image-1011" /></a></p>
<p>It seems like most of the gains came from enabling hg share on builds we weren&#8217;t previously using them on since the update times for win32 try builds weren&#8217;t affected; the only change for them would be pulling from the dedicated mirrors instead of the main hg.</p>
]]></content:encoded>
			<wfw:commentRss>http://atlee.ca/blog/2011/11/22/a-small-battle-won-in-the-war-on-build-times/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Going faster!</title>
		<link>http://atlee.ca/blog/2011/10/17/going-faster/</link>
		<comments>http://atlee.ca/blog/2011/10/17/going-faster/#comments</comments>
		<pubDate>Mon, 17 Oct 2011 20:15:42 +0000</pubDate>
		<dc:creator>chris</dc:creator>
				<category><![CDATA[Mozilla]]></category>

		<guid isPermaLink="false">http://atlee.ca/blog/?p=997</guid>
		<description><![CDATA[Thanks to lots of hard work from people like John Ford and Rafael Ávila de Espíndola, we&#8217;ve made some great progress getting our total build + test time down. Average test times have taken a dip due to optimizations on debug builds: Average build times have also taken a dip due to disabling PGO: These [...]]]></description>
			<content:encoded><![CDATA[<p>Thanks to lots of hard work from people like <a href="http://johnford.info/">John Ford</a> and <a href="http://blog.mozilla.com/respindola/">Rafael Ávila de Espíndola</a>, we&#8217;ve made some great progress getting our total build + test time down.</p>
<p>Average test times have taken a dip due to optimizations on debug builds:<br />
<a href="http://brasstacks.mozilla.com/gofaster/#/executiontime/test"><img src="http://people.mozilla.org/~catlee/sattap/5d61b49f.png" alt="test times"/></a></p>
<p>Average build times have also taken a dip due to disabling PGO:<br />
<a href="http://brasstacks.mozilla.com/gofaster/#/executiontime/build"><img src="http://people.mozilla.org/~catlee/sattap/b7cb1ff5.png" alt="build times"/></a></p>
<p>These awesome visualizations are brought do you by the <a href="http://brasstacks.mozilla.com/gofaster/#/">Go Faster!</a> dashboard. If you haven&#8217;t seen it before, go check it out now!</p>
]]></content:encoded>
			<wfw:commentRss>http://atlee.ca/blog/2011/10/17/going-faster/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>mozconfigs and branches</title>
		<link>http://atlee.ca/blog/2011/09/30/mozconfigs-and-branches/</link>
		<comments>http://atlee.ca/blog/2011/09/30/mozconfigs-and-branches/#comments</comments>
		<pubDate>Fri, 30 Sep 2011 20:08:15 +0000</pubDate>
		<dc:creator>chris</dc:creator>
				<category><![CDATA[Mozilla]]></category>

		<guid isPermaLink="false">http://atlee.ca/blog/?p=984</guid>
		<description><![CDATA[Firefox&#8217;s mozconfigs have lived in RelEng&#8217;s buildbot-configs repo since the dawn of time&#8230;well, at least as long as I&#8217;ve been here, so that&#8217;s a few years at least! With our new rapid release schedule and the explosion of project branches, it&#8217;s become much more difficult to keep the mozconfigs in sync with code changes across [...]]]></description>
			<content:encoded><![CDATA[<p>Firefox&#8217;s mozconfigs have lived in RelEng&#8217;s <a href="http://hg.mozilla.org/build/buildbot-configs/file/production/mozilla2/">buildbot-configs repo</a> since the dawn of time&#8230;well, at least as long as I&#8217;ve been here, so that&#8217;s a few years at least!</p>
<p>With our new rapid release schedule and the explosion of project branches, it&#8217;s become much more difficult to keep the mozconfigs in sync with code changes across merges between branches. It&#8217;s always been difficult to coordinate landing code changes with mozconfig changes; and since mozconfig changes happened out of band from regular source code changes, they were invisible on tbpl.</p>
<p>We&#8217;ve recently changed the build automation so that mozconfigs will be first checked for in e.g. $topsrcdir/browser/config/mozconfigs/$platform/{nightly,debug}. If this file exists it will be copied into $topsrcdir/.mozconfig, otherwise the original mozconfig will be fetched from hg.</p>
<p>There are two major benefits to this change:</p>
<ul>
<li>mozconfig changes are now a distinct point in the development history of the product itself. This means that changes to compiler versions, optimization flags, etc. are tracked along with regular code changes. Changes to the mozconfigs will trigger builds and tests like any other code changes.</li>
<li>Changes to the mozconfigs will automatically be carried over between branches during a merge. If you change the compiler used in mozilla-central, then the next time we merge mozilla-central into mozilla-aurora the change to compiler will be merged as well.</li>
</ul>
<p>Of course this means that if your branch has special settings in your mozconfig, then you need to be careful when merging back to mozilla-central or mozilla-inbound. We&#8217;ll also have to ensure certain changes like &#8211;enable-js-diagnostics are turned off when we move from mozilla-central to mozilla-aurora.</p>
<p><strong>In particular, on your first merge from mozilla-central, any custom mozconfig settings you have will be lost.</strong></p>
<p>I&#8217;m planning on landing the mozconfigs into mozilla-central early next week. As always, if you have any question, comments, or concerns, please let me or anybody else in RelEng know!</p>
<p>For all the gory details, see <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=558180">bug 558180</a>.</p>
<p><strong><em>UPDATE:</em></strong><br />
Branches currently using the generic configs (eg try, places, twigs) will lose support for mozconfig-extra[-&lt;platform&gt;].</p>
]]></content:encoded>
			<wfw:commentRss>http://atlee.ca/blog/2011/09/30/mozconfigs-and-branches/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>cURL and paste</title>
		<link>http://atlee.ca/blog/2011/08/16/curl-and-paste/</link>
		<comments>http://atlee.ca/blog/2011/08/16/curl-and-paste/#comments</comments>
		<pubDate>Wed, 17 Aug 2011 04:17:31 +0000</pubDate>
		<dc:creator>chris</dc:creator>
				<category><![CDATA[Python]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[performance]]></category>

		<guid isPermaLink="false">http://atlee.ca/blog/?p=975</guid>
		<description><![CDATA[cURL and paste&#8230;two great tastes that apparently don&#8217;t go well at all together! I&#8217;ve been writing a bunch of simple wsgi apps lately, some of which handle file uploads. Take this tiny application: import webob &#160; def app&#40;environ, start_response&#41;: req = webob.Request&#40;environ&#41; req.body_file.read&#40;&#41; return webob.Response&#40;&#34;OK!&#34;&#41;&#40;environ, start_response&#41; &#160; import paste.httpserver paste.httpserver.serve&#40;app, port=8090&#41; Then throw some files [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://curl.haxx.se/" target="_blank">cURL</a> and <a href="http://pythonpaste.org/" target="_blank">paste</a>&#8230;two great tastes that apparently don&#8217;t go well at all together!</p>
<p>I&#8217;ve been writing a bunch of simple <a href="http://wsgi.org/wsgi/" target="_blank">wsgi</a> apps lately, some of which handle file uploads.</p>
<p>Take this tiny application:</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;"><span style="color: #ff7700;font-weight:bold;">import</span> webob
&nbsp;
<span style="color: #ff7700;font-weight:bold;">def</span> app<span style="color: black;">&#40;</span>environ, start_response<span style="color: black;">&#41;</span>:
    req = webob.<span style="color: black;">Request</span><span style="color: black;">&#40;</span>environ<span style="color: black;">&#41;</span>
    req.<span style="color: black;">body_file</span>.<span style="color: black;">read</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
    <span style="color: #ff7700;font-weight:bold;">return</span> webob.<span style="color: black;">Response</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;OK!&quot;</span><span style="color: black;">&#41;</span><span style="color: black;">&#40;</span>environ, start_response<span style="color: black;">&#41;</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">import</span> paste.<span style="color: black;">httpserver</span>
paste.<span style="color: black;">httpserver</span>.<span style="color: black;">serve</span><span style="color: black;">&#40;</span>app, port=<span style="color: #ff4500;">8090</span><span style="color: black;">&#41;</span></pre></div></div>

<p>Then throw some files at it with cURL:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">&#91;</span>catlee<span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #000000; font-weight: bold;">%</span> <span style="color: #000000; font-weight: bold;">for</span> f <span style="color: #000000; font-weight: bold;">in</span> $<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #c20cb9; font-weight: bold;">find</span> <span style="color: #660033;">-type</span> f<span style="color: #7a0874; font-weight: bold;">&#41;</span>; <span style="color: #000000; font-weight: bold;">do</span> <span style="color: #000000; font-weight: bold;">time</span> curl <span style="color: #660033;">-s</span> <span style="color: #660033;">-o</span> <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>null <span style="color: #660033;">--data-binary</span> <span style="color: #000000; font-weight: bold;">@</span><span style="color: #007800;">$f</span> http:<span style="color: #000000; font-weight: bold;">//</span>localhost:<span style="color: #000000;">8090</span>; <span style="color: #000000; font-weight: bold;">done</span>
curl <span style="color: #660033;">-s</span> <span style="color: #660033;">-o</span> <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>null <span style="color: #660033;">--data-binary</span> <span style="color: #000000; font-weight: bold;">@</span><span style="color: #007800;">$f</span> http:<span style="color: #000000; font-weight: bold;">//</span>localhost:<span style="color: #000000;">8090</span>  0.00s user 0.00s system <span style="color: #000000;">0</span><span style="color: #000000; font-weight: bold;">%</span> cpu <span style="color: #000000;">1.013</span> total
curl <span style="color: #660033;">-s</span> <span style="color: #660033;">-o</span> <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>null <span style="color: #660033;">--data-binary</span> <span style="color: #000000; font-weight: bold;">@</span><span style="color: #007800;">$f</span> http:<span style="color: #000000; font-weight: bold;">//</span>localhost:<span style="color: #000000;">8090</span>  0.01s user 0.00s system <span style="color: #000000;">63</span><span style="color: #000000; font-weight: bold;">%</span> cpu <span style="color: #000000;">0.013</span> total
curl <span style="color: #660033;">-s</span> <span style="color: #660033;">-o</span> <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>null <span style="color: #660033;">--data-binary</span> <span style="color: #000000; font-weight: bold;">@</span><span style="color: #007800;">$f</span> http:<span style="color: #000000; font-weight: bold;">//</span>localhost:<span style="color: #000000;">8090</span>  0.01s user 0.00s system <span style="color: #000000;">64</span><span style="color: #000000; font-weight: bold;">%</span> cpu <span style="color: #000000;">0.012</span> total
curl <span style="color: #660033;">-s</span> <span style="color: #660033;">-o</span> <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>null <span style="color: #660033;">--data-binary</span> <span style="color: #000000; font-weight: bold;">@</span><span style="color: #007800;">$f</span> http:<span style="color: #000000; font-weight: bold;">//</span>localhost:<span style="color: #000000;">8090</span>  0.01s user 0.00s system <span style="color: #000000;">81</span><span style="color: #000000; font-weight: bold;">%</span> cpu <span style="color: #000000;">0.015</span> total
curl <span style="color: #660033;">-s</span> <span style="color: #660033;">-o</span> <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>null <span style="color: #660033;">--data-binary</span> <span style="color: #000000; font-weight: bold;">@</span><span style="color: #007800;">$f</span> http:<span style="color: #000000; font-weight: bold;">//</span>localhost:<span style="color: #000000;">8090</span>  0.01s user 0.00s system <span style="color: #000000;">0</span><span style="color: #000000; font-weight: bold;">%</span> cpu <span style="color: #000000;">1.014</span> total
curl <span style="color: #660033;">-s</span> <span style="color: #660033;">-o</span> <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>null <span style="color: #660033;">--data-binary</span> <span style="color: #000000; font-weight: bold;">@</span><span style="color: #007800;">$f</span> http:<span style="color: #000000; font-weight: bold;">//</span>localhost:<span style="color: #000000;">8090</span>  0.00s user 0.00s system <span style="color: #000000;">0</span><span style="color: #000000; font-weight: bold;">%</span> cpu <span style="color: #000000;">1.009</span> total</pre></div></div>

<p>Huh? Some files take a second to upload?</p>
<p>I discovered after much digging, and rewriting my (more complicated) app several times, that the problem is that cURL sends an extra &#8220;Expect: 100-continue&#8221; header. This is supposed to let a web server respond with &#8220;100 Continue&#8221; immediately or reject an upload based on the request headers.</p>
<p>The problem is that paste&#8217;s httpserver doesn&#8217;t send this by default, and so cURL will wait for a second before giving up and sending the rest of the request.</p>
<p>The magic to turn this off is the &#8216;-0&#8242; to cURL, which forces HTTP/1.0 mode:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">&#91;</span>catlee<span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #000000; font-weight: bold;">%</span> <span style="color: #000000; font-weight: bold;">for</span> f <span style="color: #000000; font-weight: bold;">in</span> $<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #c20cb9; font-weight: bold;">find</span> <span style="color: #660033;">-type</span> f<span style="color: #7a0874; font-weight: bold;">&#41;</span>; <span style="color: #000000; font-weight: bold;">do</span> <span style="color: #000000; font-weight: bold;">time</span> curl <span style="color: #660033;">-0</span> <span style="color: #660033;">-s</span> <span style="color: #660033;">-o</span> <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>null <span style="color: #660033;">--data-binary</span> <span style="color: #000000; font-weight: bold;">@</span><span style="color: #007800;">$f</span> http:<span style="color: #000000; font-weight: bold;">//</span>localhost:<span style="color: #000000;">8090</span>; <span style="color: #000000; font-weight: bold;">done</span>
curl <span style="color: #660033;">-0</span> <span style="color: #660033;">-s</span> <span style="color: #660033;">-o</span> <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>null <span style="color: #660033;">--data-binary</span> <span style="color: #000000; font-weight: bold;">@</span><span style="color: #007800;">$f</span> http:<span style="color: #000000; font-weight: bold;">//</span>localhost:<span style="color: #000000;">8090</span>  0.00s user 0.00s system <span style="color: #000000;">66</span><span style="color: #000000; font-weight: bold;">%</span> cpu <span style="color: #000000;">0.012</span> total
curl <span style="color: #660033;">-0</span> <span style="color: #660033;">-s</span> <span style="color: #660033;">-o</span> <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>null <span style="color: #660033;">--data-binary</span> <span style="color: #000000; font-weight: bold;">@</span><span style="color: #007800;">$f</span> http:<span style="color: #000000; font-weight: bold;">//</span>localhost:<span style="color: #000000;">8090</span>  0.01s user 0.00s system <span style="color: #000000;">64</span><span style="color: #000000; font-weight: bold;">%</span> cpu <span style="color: #000000;">0.012</span> total
curl <span style="color: #660033;">-0</span> <span style="color: #660033;">-s</span> <span style="color: #660033;">-o</span> <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>null <span style="color: #660033;">--data-binary</span> <span style="color: #000000; font-weight: bold;">@</span><span style="color: #007800;">$f</span> http:<span style="color: #000000; font-weight: bold;">//</span>localhost:<span style="color: #000000;">8090</span>  0.00s user 0.01s system <span style="color: #000000;">58</span><span style="color: #000000; font-weight: bold;">%</span> cpu <span style="color: #000000;">0.014</span> total
curl <span style="color: #660033;">-0</span> <span style="color: #660033;">-s</span> <span style="color: #660033;">-o</span> <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>null <span style="color: #660033;">--data-binary</span> <span style="color: #000000; font-weight: bold;">@</span><span style="color: #007800;">$f</span> http:<span style="color: #000000; font-weight: bold;">//</span>localhost:<span style="color: #000000;">8090</span>  0.01s user 0.00s system <span style="color: #000000;">66</span><span style="color: #000000; font-weight: bold;">%</span> cpu <span style="color: #000000;">0.012</span> total
curl <span style="color: #660033;">-0</span> <span style="color: #660033;">-s</span> <span style="color: #660033;">-o</span> <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>null <span style="color: #660033;">--data-binary</span> <span style="color: #000000; font-weight: bold;">@</span><span style="color: #007800;">$f</span> http:<span style="color: #000000; font-weight: bold;">//</span>localhost:<span style="color: #000000;">8090</span>  0.00s user 0.00s system <span style="color: #000000;">59</span><span style="color: #000000; font-weight: bold;">%</span> cpu <span style="color: #000000;">0.013</span> total
curl <span style="color: #660033;">-0</span> <span style="color: #660033;">-s</span> <span style="color: #660033;">-o</span> <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>null <span style="color: #660033;">--data-binary</span> <span style="color: #000000; font-weight: bold;">@</span><span style="color: #007800;">$f</span> http:<span style="color: #000000; font-weight: bold;">//</span>localhost:<span style="color: #000000;">8090</span>  0.01s user 0.00s system <span style="color: #000000;">65</span><span style="color: #000000; font-weight: bold;">%</span> cpu <span style="color: #000000;">0.012</span> total</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://atlee.ca/blog/2011/08/16/curl-and-paste/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

