Git is fast. Everyone—even most of the hard core users of these
other systems—generally give Git this title. With Git, all
operations are performed locally giving it a bit of a leg up on
SVN and Perforce, both of which require network access for certain operations.
However, even compared to the other DSCMs that also perform operations
locally, Git is pretty fast.
Part of this is likely because it was built to work on the Linux
kernel, which means that it has had to deal effectively with large
repositories from day one. Additionally, Git is written in C, reducing the
overhead of runtimes associated with higher-level languages.
Another reason that Git is so fast is that the primary developers
have made this a design goal of the application.
The following are a number of benchmarks that I performed on three
copies of the Django source code repository in 3 different SCMs:
Git, Mercurial and Bazaar. I also tested some of this stuff in SVN,
but trust me, it's slower—basically take the Bazaar numbers and
then add network latency...
The end result was that for everything but adding new files, Git
was fastest. (Also really large commits, which Hg was basically the
same at, but the commit I tested was so large that you're unlikely
to ever do anything like it—normal commits are much faster in Git.)
|
Git |
Hg |
Bzr |
Init |
0.024s |
0.059s |
0.600s |
Add |
8.535s |
0.368s |
2.381s |
Status |
0.451s |
1.946s |
14.744s |
Diff |
0.543s |
2.189s |
14.248s |
Tag |
0.056s |
1.201s |
1.892s |
Log |
0.711s |
2.650s |
9.055s |
Commit (Large) |
12.480s |
12.500s |
23.002s |
Commit (Small) |
0.086s |
0.517s |
1.139s |
Branch (Cold) |
1.161s |
94.681s |
82.249s |
Branch (Hot) |
0.070s |
12.300s |
39.411s |
The cold and hot branching numbers are the numbers for the first
and second times that I branched a repo—the second number being
a branch with a hot disk cache.
It should be noted that although the 'add' numbers are much slower,
this was for a massive add operation—over 2000 files. For the
majority of what most people do on a daily basis, add ops in any
of these systems will only take a fraction of a second. All of the
other ops tested here (except for the large commit, possibly) are
more indicative of things you might actually do day to day.
These numbers are really not difficult to recreate, simply clone the Django
project in each of the systems and try out the same commands in each.
git clone git://github.com/brosner/django.git dj-git
hg clone http://hg.dpaste.com/django/trunk dj-hg
bzr branch lp:django dj-bzr
svn checkout http://code.djangoproject.com/svn/django/trunk dj-svn