Performance issues when merging branches (1000+ files being merged takes 75~ seconds)

Idan K idan at kamarafamily.com
Wed Jun 16 16:46:18 CDT 2010


Hi,

As part of choosing a SCM, the usual debate between Mercurial and Git has
begun in our work place, we decided to do some benchmarks. One of the tests
was this:

1. Clone Mercurial's repository (http://hg.intevation.org/mercurial/),
updated to default.
2. Create a named branch "branch-a".
3. For every file in the repository, insert a new line after line #3 (if the
file contains 3 lines), containing "### ADDED TEXT ###".
4. Commit.
5. Update back to default.
6. Create a named branch "branch-b".
7. Repeat step 3, but for line #9.
8. Commit.
9. Merge "branch-a" to "branch-b".

I ran this test on a Ubuntu 10.04 with Mercurial 1.5.4 and the result was
quite surprising to say the least: Step #9 took about 75 seconds (average of
5 runs) on a Q6600 with 4GB RAM, ext4 drive.
I also ran the same test with Git (using fast-export to covert Mercurial's
repository to Git) to get an idea of what I should be getting, and this time
step #9 took an average of 1 second. That's quite a difference. I know
Mercurial is written in Python (with some C modules) and Git in C, but can
the gap be that big?

I've attached a small Python script that inserts the lines the way I
described above, and a bash script that runs the hg commands, and also times
the problematic "hg merge" (forgive my poor bash skills, I usually script in
Python, but for simplicity I tried bash this time).
You can either give it a path to a local repository to work with, or without
arguments it will clone mercurial's repository and work with that.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://selenic.com/pipermail/mercurial-devel/attachments/20100617/2d1edbb5/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test_hgmerge.sh
Type: application/x-sh
Size: 562 bytes
Desc: not available
URL: <http://selenic.com/pipermail/mercurial-devel/attachments/20100617/2d1edbb5/attachment.sh>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: modify_files.py
Type: text/x-python
Size: 583 bytes
Desc: not available
URL: <http://selenic.com/pipermail/mercurial-devel/attachments/20100617/2d1edbb5/attachment.py>


More information about the Mercurial-devel mailing list