CINXE.COM
Git - Small and Fast
<!DOCTYPE html> <html lang="en"> <head> <meta charset='utf-8'> <meta content='IE=edge,chrome=1' http-equiv='X-UA-Compatible'> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>Git - Small and Fast</title> <link href="/favicon.ico" rel='shortcut icon' type='image/x-icon'> <link rel="stylesheet" href="/application.min.css"> <script src="/js/modernizr.js"></script> <script src="/js/modernize.js"></script> </head> <body id="about"> <div class="inner"> <header> <a href="/"><img src="/images/logo@2x.png" width="110" height="46" alt="Git" /></a> <span id="tagline"></span> <script type="text/javascript"> const taglines = [ "fast-version-control", "everything-is-local", "distributed-even-if-your-workflow-isnt", "local-branching-on-the-cheap", "distributed-is-the-new-centralized" ]; var tagline = taglines[Math.floor(Math.random() * taglines.length)]; document.getElementById('tagline').innerHTML = '--' + tagline; </script> <form id="search" action="/search/results"> <input id="search-text" name="search" placeholder="Type / to search entire site…" autocomplete="off" type="text" /> </form> <div id="search-results"></div> </header> </div> <div class="inner"> <div id="content-wrapper"> <div tabindex="1" class="sidebar-btn"></div> <aside class="sidebar" id="sidebar"> <nav> <ul> <li> <a href="/about" class="active">About</a> <ul class="expanded"> <li> <a href="/about/branching-and-merging">Branching and Merging</a> </li> <li> <a href="/about/small-and-fast" class="active">Small and Fast</a> </li> <li> <a href="/about/distributed">Distributed</a> </li> <li> <a href="/about/data-assurance">Data Assurance</a> </li> <li> <a href="/about/staging-area">Staging Area</a> </li> <li> <a href="/about/free-and-open-source">Free and Open Source</a> </li> <li> <a href="/about/trademark">Trademark</a> </li> </ul> </li> <li> <a href="/doc">Documentation</a> <ul > <li> <a href="/docs">Reference</a> </li> <li> <a href="/book">Book</a> </li> <li> <a href="/videos">Videos</a> </li> <li> <a href="/doc/ext">External Links</a> </li> </ul> </li> <li> <a href="/downloads">Downloads</a> <ul > <li> <a href="/downloads/guis">GUI Clients</a> </li> <li> <a href="/downloads/logos">Logos</a> </li> </ul> </li> <li> <a href="/community">Community</a> </li> </ul> <hr class="sidebar"> <div class="callout"> <p>The entire <strong><a href="/book">Pro Git book</a></strong> written by Scott Chacon and Ben Straub is available to <a href="/book">read online for free</a>. Dead tree versions are available on <a href="https://www.amazon.com/Pro-Git-Scott-Chacon/dp/1484200772?ie=UTF8&camp=1789&creative=9325&creativeASIN=1430218339&linkCode=as2&tag=git-sfconservancy-20">Amazon.com</a>. </p> </div> </nav> </aside> <div id="content" data-pagefind-filter="category:about" data-pagefind-weight="0.05" data-pagefind-body> <div id="main"> <h1 data-pagefind-meta="title">About - Small and Fast</h1> <ol id="about-nav"> <li> <a href="/about/branching-and-merging" class="three-line">Branching and Merging</a> </li> <li> <a href="/about/small-and-fast" class="two-line current">Small and Fast</a> </li> <li> <a href="/about/distributed" class="one-line">Distributed</a> </li> <li> <a href="/about/data-assurance" class="two-line">Data Assurance</a> </li> <li> <a href="/about/staging-area" class="two-line">Staging Area</a> </li> <li> <a href="/about/free-and-open-source" class="three-line">Free and Open Source</a> </li> <li> <a href="/about/trademark" class="one-line">Trademark</a> </li> </ol> <section class="about" id="small-and-fast"> <h2>Small and Fast</h2> <p> <strong>Git is fast</strong>. With Git, nearly all operations are performed locally, giving it a huge speed advantage on centralized systems that constantly have to communicate with a server somewhere. </p> <p> Git was built to work on the Linux kernel, meaning that it has had to effectively handle large repositories from day one. Git is written in C, reducing the overhead of runtimes associated with higher-level languages. Speed and performance has been a primary design goal of Git from the start. </p> <h3>Benchmarks</h3> <p> Let's see how common operations stack up against Subversion, a common centralized version control system that is similar to CVS or Perforce. <em>Smaller is faster.</em> </p> <div class="bar-chart-grid"> <div> <dl class="bar-chart"> <dt>Commit A</dt> <dd> <progress value="0.649" max="3" class="git"></progress> <span>git</span> </dd> <dd> <progress value="2.6" max="3" class="svn"></progress> <span>svn</span> </dd> </dl> </div> <div> <dl class="bar-chart"> <dt>Commit B</dt> <dd> <progress value="1.53" max="25" class="git"></progress> <span>git</span> </dd> <dd> <progress value="24.7" max="25" class="svn"></progress> <span>svn</span> </dd> </dl> </div> <div> <dl class="bar-chart"> <dt>Diff Curr</dt> <dd> <progress value="0.257" max="1.2" class="git"></progress> <span>git</span> </dd> <dd> <progress value="1.09" max="1.2" class="svn"></progress> <span>svn</span> </dd> </dl> </div> <div> <dl class="bar-chart"> <dt>Diff Rec</dt> <dd> <progress value="0.248" max="4" class="git"></progress> <span>git</span> </dd> <dd> <progress value="3.99" max="4" class="svn"></progress> <span>svn</span> </dd> </dl> </div> <div> <dl class="bar-chart"> <dt>Diff Tags</dt> <dd> <progress value="1.17" max="85" class="git"></progress> <span>git</span> </dd> <dd> <progress value="83.57" max="85" class="svn"></progress> <span>svn</span> </dd> </dl> </div> <div> <dl class="bar-chart"> <dt>Clone</dt> <dd> <progress value="21.0" max="110" class="git"></progress> <span>git*</span> </dd> <dd> <progress value="107.5" max="110" class="git"></progress> <span>git</span> </dd> <dd> <progress value="14.0" max="110" class="svn"></progress> </dd> </dl> </div> <div> <dl class="bar-chart"> <dt>Log (50)</dt> <dd> <progress value="0.012" max="0.4" class="git"></progress> <span>git</span> </dd> <dd> <progress value="0.381" max="0.4" class="svn"></progress> <span>svn</span> </dd> </dl> </div> <div> <dl class="bar-chart"> <dt>Log (All)</dt> <dd> <progress value="0.519" max="170" class="git"></progress> <span>git</span> </dd> <dd> <progress value="169.197" max="170" class="svn"></progress> <span>svn</span> </dd> </dl> </div> <div> <dl class="bar-chart"> <dt>Log (File)</dt> <dd> <progress value="0.601" max="83" class="git"></progress> <span>git</span> </dd> <dd> <progress value="82.843" max="83" class="svn"></progress> <span>svn</span> </dd> </dl> </div> <div> <dl class="bar-chart"> <dt>Update</dt> <dd> <progress value="0.896" max="2.9" class="git"></progress> <span>git</span> </dd> <dd> <progress value="2.816" max="2.9" class="svn"></progress> <span>svn</span> </dd> </dl> </div> <div> <dl class="bar-chart"> <dt>Blame</dt> <dd> <progress value="1.91" max="3.1" class="git"></progress> <span>git</span> </dd> <dd> <progress value="3.04" max="3.1" class="svn"></progress> <span>svn</span> </dd> </dl> </div> <div> <dl class="bar-chart"> <dt>Size</dt> <dd> <progress value="181" max="182" class="git"></progress> <span>git</span> </dd> <dd> <progress value="132" max="182" class="svn"></progress> <span>svn</span> </dd> </dl> </div> </div> <p> For testing, large AWS instances were set up in the same availability zone. Git and SVN were installed on both machines, the Ruby repository was copied to both Git and SVN servers, and common operations were performed on both. </p> <p> In some cases, the commands don't match up exactly. Here, matching on the lowest common denominator was attempted. For example, the 'commit' tests also include the time to push for Git, though most of the time you would not actually be pushing to the server immediately after a commit where the two commands cannot be separated in SVN. </p> <p> All of these times are in seconds. </p> <div class="responsive-table"> <table class="benchmarks"> <tbody> <tr> <th>Operation</th> <th></th> <th class="right">Git</th> <th class="right">SVN</th> </tr> <tr><td nowrap="">Commit Files (A)</td><td class="desc">Add, commit and push 113 modified files (2164+, 2259-)</td><td class="number">0.64</td><td class="number">2.60</td><td class="number">4x</td></tr> <tr><td nowrap="">Commit Images (B)</td><td class="desc">Add, commit and push a thousand 1 kB images</td><td class="number">1.53</td><td class="number">24.70</td><td class="number">16x</td></tr> <tr><td nowrap="">Diff Current</td><td class="desc">Diff 187 changed files (1664+, 4859-) against last commit</td><td class="number">0.25</td><td class="number">1.09</td><td class="number">4x</td></tr> <tr><td nowrap="">Diff Recent</td><td class="desc">Diff against 4 commits back (269 changed/3609+,6898-)</td><td class="number">0.25</td><td class="number">3.99</td><td class="number">16x</td></tr> <tr><td nowrap="">Diff Tags</td><td class="desc">Diff two tags against each other (v1.9.1.0/v1.9.3.0)</td><td class="number">1.17</td><td class="number">83.57</td><td class="number">71x</td></tr> <tr><td nowrap="">Log (50)</td><td class="desc">Log of the last 50 commits (19 kB of output)</td><td class="number">0.01</td><td class="number">0.38</td><td class="number">31x</td></tr> <tr><td nowrap="">Log (All)</td><td class="desc">Log of all commits (26,056 commits – 9.4 MB of output)</td><td class="number">0.52</td><td class="number">169.20</td><td class="number">325x</td></tr> <tr><td nowrap="">Log (File)</td><td class="desc">Log of the history of a single file (array.c – 483 revs)</td><td class="number">0.60</td><td class="number">82.84</td><td class="number">138x</td></tr> <tr><td nowrap="">Update</td><td class="desc">Pull of Commit A scenario (113 files changed, 2164+, 2259-)</td><td class="number">0.90</td><td class="number">2.82</td><td class="number">3x</td></tr> <tr><td nowrap="">Blame</td><td class="desc">Line annotation of a single file (array.c)</td><td class="number">1.91</td><td class="number">3.04</td><td class="number">1x</td></tr> </tbody> </table> </div> <p> Note that this is the best case scenario for SVN—a server with no load with a gigabit connection to the client machine. Nearly all of these times would be even worse for SVN if that connection was slower, while many of the Git times would not be affected. </p> <p> Clearly, in many of these common version control operations, <strong>Git is one or two orders of magnitude faster than SVN</strong>, even under ideal conditions for SVN. </p> <p> One place where Git is slower is in the initial clone operation. Here, Git is downloading the entire history rather than only the latest version. As seen in the above charts, it's not considerably slower for an operation that is only performed once. </p> <div class="responsive-table"> <table class="benchmarks"> <tbody> <tr> <th>Operation</th> <th></th> <th class="right">Git*</th> <th class="right">Git</th> <th class="right">SVN</th> </tr> <tr><td nowrap="">Clone</td><td class="desc">Clone and shallow clone(*) in Git vs checkout in SVN</td><td class="number">21.0</td><td class="number">107.5</td><td class="number">14.0</td></tr> <tr><td nowrap="">Size (MB)</td><td class="desc">Size of total client side data and files after clone/checkout (in MB)</td><td></td><td class="number">181.0</td><td class="number">132.0</td></tr> </tbody> </table> </div> <p> It's also interesting to note that the size of the data on the client side is very similar even though Git also has every version of every file for the entire history of the project. This illustrates how efficient it is at compressing and storing data on the client side. </p> <div class="bottom-nav" style="display: block;"> <a href="/about/branching-and-merging" class="previous" data-section-id="branching-and-merging">← Branching and Merging</a> <a href="/about/distributed" class="next" data-section-id="distributed">Distributed →</a> </div> </section> </div> </div> </div> <footer> <div class="site-source"> <a href="/site">About this site</a><br> Patches, suggestions, and comments are welcome. </div> <div class="sfc-member"> Git is a member of <a href="/sfc">Software Freedom Conservancy</a> </div> </footer> <a href="#top" class="no-js scrollToTop" id="scrollToTop" data-label="Scroll to top"> <img src="/images/icons/chevron-up@2x.png" width="20" height="20" alt="scroll-to-top"/> </a> <script src="/js/jquery-1.7.1.min.js"></script> <script src="/js/jquery-ui-1.8.18.custom.min.js"></script> <script src="/js/jquery.defaultvalue.js"></script> <script src="/js/session.min.js"></script> <script src="/js/application.min.js"></script> </div> </body> </html>