diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2007-08-10 12:31:20 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2007-08-10 14:00:25 -0700 |
commit | d699676dda5fdf0996601006c3bac2a9c077a862 (patch) | |
tree | ba6f5a6c7a4c6d4fbde7cf250e3ee546779cb589 /rsh.c | |
parent | Optimize the common cases of git-read-tree (diff) | |
download | tgif-d699676dda5fdf0996601006c3bac2a9c077a862.tar.xz |
Optimize the two-way merge of git-read-tree too
This trivially optimizes the two-way merge case of git-read-tree too,
which affects switching branches.
When you have tons and tons of files in your repository, but there are
only small differences in the branches (maybe just a couple of files
changed), the biggest cost of the branch switching was actually just the
index calculations.
This fixes it (timings for switching between the "testing" and "master"
branches in the 100,000 file testing-repo-from-hell, where the branches
only differ in one small file).
Before:
[torvalds@woody bummer]$ time git checkout master
real 0m9.919s
user 0m8.461s
sys 0m0.264s
After:
[torvalds@woody bummer]$ time git checkout testing
real 0m0.576s
user 0m0.348s
sys 0m0.228s
so it's easily an order of magnitude different.
This concludes the series. I think we could/should do the three-way merge
too (to speed up merges), but I'm lazy. Somebody else can do it.
The rule is very simple: you need to remove the old entry if:
- you want to remove the file entirely
- you replace it with a "merge conflict" entry (ie a non-stage-0 entry)
and you can avoid removing it if you either
- keep the old one
- or resolve it to a new one.
and these rules should all be valid for the three-way case too.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'rsh.c')
0 files changed, 0 insertions, 0 deletions