<?xml version="1.0" encoding="UTF-8"?>
<wiki>
  <body>&lt;p&gt;I&amp;#8217;ve started integrating the GitRuby raw access library,  a way to interact with Git in pure ruby, into Grit in my fork.  It&amp;#8217;s not quite done &amp;#8211; it won&amp;#8217;t work with things like the &amp;#8216;&lt;span class=&quot;caps&quot;&gt;XXX&lt;/span&gt;&amp;#8230;&lt;span class=&quot;caps&quot;&gt;YYY&lt;/span&gt;&amp;#8217; range strings in log, or the &amp;#8216;skip&amp;#8217; dingus, but it does work for a number of things.  I&amp;#8217;ve implemented it as a module that is included in the Grit::Git class &amp;#8211; since all the git calls are captured by the &amp;#8216;method_missing&amp;#8217; function, I simply implement the ones I want to override and try in pure ruby &amp;#8211; if I can&amp;#8217;t do it, sometimes I fall back to the method_missing, which will do a &amp;#8216;git&amp;#8217; system call.&lt;/p&gt;
&lt;p&gt;So far I&amp;#8217;ve overridden the cat_file, ls_tree, rev_parse and the rev_list and log functions (which are essentially the same thing, since we&amp;#8217;re passing &amp;#8212;pretty=&amp;#8220;raw&amp;#8221; to rev-list, which makes it identical to &amp;#8216;git log&amp;#8217;). There are significant speed increases in the short calls (like cat-file, ls_tree, etc) and only becomes worse than the system calls if we&amp;#8217;re doing some massive commit walk (&amp;#8216;git rev-list &amp;#8212;all&amp;#8217;, for example).&lt;/p&gt;
&lt;h3&gt;Grit 0.7.0&lt;/h3&gt;
&lt;pre class=&quot;console&quot;&gt;
              user     system      total        real
packobj       0.030000   0.260000   1.320000 (  1.344565)
commits 1     0.030000   0.070000   0.380000 (  0.366209)
commits 2     0.110000   0.160000   0.830000 (  0.802311)
big revlist   0.330000   0.130000   0.830000 (  0.795258)
log           0.380000   0.140000   0.880000 (  0.856951)
diff          0.330000   0.190000   2.080000 (  2.072242)
commit-diff   0.690000   0.250000   1.560000 (  1.521016)
heads         0.000000   0.070000   0.360000 (  0.376296)
&lt;/pre&gt;
&lt;h3&gt;Grit Edge (with GitRuby) :&lt;/h3&gt;
&lt;pre class=&quot;console&quot;&gt;
              user     system      total        real
packobj       0.050000   0.000000   0.050000 (  0.051167)
commits 1     0.140000   0.010000   0.150000 (  0.164900)
commits 2     0.430000   0.030000   0.460000 (  0.454646)
big revlist   1.540000   0.100000   1.640000 (  1.637204)
log           0.480000   0.030000   0.510000 (  0.512445)
diff          0.200000   0.190000   1.970000 (  1.905014)
commit-diff   0.550000   0.240000   1.420000 (  1.366508)
heads         0.020000   0.090000   0.410000 (  0.402519)
&lt;/pre&gt;</body>
  <created-at type="datetime">2008-04-19T17:06:58-07:00</created-at>
  <id type="integer">12205</id>
  <permalink>gitruby</permalink>
  <repository-id type="integer">11018</repository-id>
  <title>GitRuby</title>
  <updated-at type="datetime">2008-04-19T17:07:58-07:00</updated-at>
  <user-id type="integer">70</user-id>
</wiki>
