<?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>thinking in geek &#187; git</title>
	<atom:link href="http://joshrobb.com/blog/category/git/feed/" rel="self" type="application/rss+xml" />
	<link>http://joshrobb.com/blog</link>
	<description>tagline's are so web2.0</description>
	<lastBuildDate>Wed, 02 Jun 2010 14:47:25 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Speeding up git svn on Windows (win32)</title>
		<link>http://joshrobb.com/blog/2010/02/15/speeding-up-git-svn-on-windows-win32/</link>
		<comments>http://joshrobb.com/blog/2010/02/15/speeding-up-git-svn-on-windows-win32/#comments</comments>
		<pubDate>Mon, 15 Feb 2010 11:32:51 +0000</pubDate>
		<dc:creator>josh</dc:creator>
				<category><![CDATA[git]]></category>
		<category><![CDATA[scm]]></category>

		<guid isPermaLink="false">http://joshrobb.com/blog/?p=72</guid>
		<description><![CDATA[Update: This fix is now included in git releases 1.7.0.1 and greater &#8211; for more info &#8211; click here. Update 2: This page incorrectly stated that this patch was included in git 1.7.0.1. It&#8217;s not! It&#8217;s in the git repository&#8217;s &#8220;next&#8221; branch &#8211; which will eventually become the git 1.7.2 series. I&#8217;ll update again when [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Update:  </strong> This fix is now included in git <del datetime="2010-06-02T13:35:40+00:00">releases 1.7.0.1 and greater</del> &#8211; for more info &#8211; <a href="/blog/2010/03/01/git-svn-on-windows-speedup-now-released-in-git-1-7-0-1/">click here</a>.</p>
<p><strong>Update 2:  </strong> This page incorrectly stated that this patch was included in git 1.7.0.1. It&#8217;s not! It&#8217;s in the git repository&#8217;s &#8220;next&#8221; branch &#8211; which will eventually become the git 1.7.2 series. I&#8217;ll update again when this is released. </p>
<p>Some people have noticed that using git svn (in my case msysgit) on Windows VM&#8217;s<sup>1</sup> can be incredibly slow. I&#8217;m one of those people. </p>
<p>Running a no-op rebase (i.e. there are no changes @ the svn end) looks like this.<sup>2</sup></p>
<p><code>$ time perl git svn rebase<br />
Current branch master is up to date.</p>
<p>real    2m56.750s<br />
user    0m3.129s<br />
sys     2m39.232s</code></p>
<p>Nearly 3 minutes to verify that my local git svn branch is up to date!</p>
<p>I used to (_many_ years ago) &#8211; do quite a bit of perl for for sysadmin stuff. I&#8217;ve already paid for those sins but this was slow enough that I wanted to see what was causing the problems. </p>
<p>Running perl -d:DProf and collecting a basic trace gave me some interesting info.<sup>3</sup> SVN::Base::import (essentially a constructor) was importing all the svn dll entry points (using DynaLoader) every time git svn started up &#8211; which was extremely slow in my environment.</p>
<p>On a hunch<sup>4</sup> I moved the code which was require&#8217;ing SVN::Base::import to run lazily (rather than at git-svn startup). </p>
<p><code>$ time perl /libexec/git-core/git-svn rebase<br />
Current branch master is up to date.</p>
<p>real    0m33.407s<br />
user    0m1.409s<br />
sys     0m23.054s<br />
</code><br />
6 times faster! </p>
<p>&#8220;git svn dcommit&#8221; sped up even more. Previously:</p>
<p><code>$ time perl /libexec/git-core/git-svn.orig dcommit -n<br />
Committing to svn://XXXXX/trunk ...<br />
diff-tree befd87ba1b65fa7d86779c3058faf1f4886d7020~1 befd87ba1b65fa7d86779c3058faf1f4886d7020</p>
<p>real    3m7.046s<br />
user    0m3.190s<br />
sys     2m53.897s</code></p>
<p>Afterwards: </p>
<p><code>$ time perl /libexec/git-core/git-svn dcommit -n<br />
Committing to svn://XXXXX/trunk ...<br />
diff-tree befd87ba1b65fa7d86779c3058faf1f4886d7020~1 befd87ba1b65fa7d86779c3058faf1f4886d7020</p>
<p>real    0m10.312s<br />
user    0m1.109s<br />
sys     0m4.632s</code></p>
<p>19 times faster! </p>
<p>For me &#8211; this was enough for now. I&#8217;d spent more time on the issue than I had &#8211; and git svn operations were now fast enough to not totally break my workflow. </p>
<p>I&#8217;ve uploaded the patch here: <a href='http://joshrobb.com/blog/wp-content/uploads/2010/02/git-svn.patch.txt'>git-svn.patch</a></p>
<p>YMMV/No warranty expressed or implied/IANAL etc.  If it breaks your repo/application/life &#8211; don&#8217;t come crying to me. </p>
<p>Thanks to <a href="http://www.fastchicken.co.nz">Nic Wise</a> for testing this for me and validating my timing data etc. </p>
<ol class="footnotes"><li id="footnote_0_72" class="footnote">VMWare Fusion WinXP vm under OSX 10.5. This is probably important as people not using git svn on a VM don&#8217;t seem to sufffer such huge perf problems.</li><li id="footnote_1_72" class="footnote">[1] My svn server is 350ms away &#8211; Auckland<->London and on a VPN &#8211; I&#8217;m using the SVN protocol to access it &#8211; SVN seems fastest of the SVN protocols.</li><li id="footnote_2_72" class="footnote"><code>Total Elapsed Time = 140.4030 Seconds<br />
  User+System Time = 3.919008 Seconds<br />
Exclusive Times<br />
%Time ExclSec CumulS #Calls sec/call Csec/c  Name<br />
 77.7   3.046  3.046     12   0.2538 0.2538  DynaLoader::dl_load_file<br />
 9.16   0.359  0.359      1   0.3590 0.3590  main::read_repo_config<br />
 6.38   0.250  0.250     18   0.0139 0.0139  Git::_command_common_pipe<br />
 1.22   0.048  3.063     40   0.0012 0.0766  SVN::Base::import<br />
 1.20   0.047  0.156     22   0.0021 0.0071  main::BEGIN<br />
 0.41   0.016  0.016      4   0.0040 0.0040  Exporter::as_heavy<br />
 0.41   0.016  0.032      7   0.0023 0.0046  IO::File::BEGIN<br />
 0.41   0.016  0.016     11   0.0015 0.0015  Git::SVN::BEGIN<br />
 0.41   0.016  0.016      7   0.0023 0.0023  Git::SVN::rev_map_max_norebuild<br />
 0.41   0.016  0.016      7   0.0023 0.0023  SVN::Git::Fetcher::BEGIN<br />
 0.38   0.015  0.015      1   0.0150 0.0150  warnings::BEGIN<br />
 0.38   0.015  0.015      7   0.0021 0.0021  Git::BEGIN<br />
 0.38   0.015  0.015     13   0.0012 0.0011  Error::subs::try<br />
 0.00   0.000  0.000      1   0.0000 0.0000  XSLoader::bootstrap_inherit<br />
 0.00   0.000  0.000      1   0.0000 0.0000  Exporter::Heavy::heavy_export_tags<br />
</code><br />
</li><li id="footnote_3_72" class="footnote">git-svn shell&#8217;s out to itself a bunch so it seemed an obvious first step. </li></ol>]]></content:encoded>
			<wfw:commentRss>http://joshrobb.com/blog/2010/02/15/speeding-up-git-svn-on-windows-win32/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
	</channel>
</rss>
