diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2009-05-09 14:57:30 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2009-05-09 20:42:19 -0700 |
commit | 658dd48c8572d0db49719cbef6605d384621d87c (patch) | |
tree | 1b6ccfa86f6c8e8c9ea78c6877657547c0af7e59 /diff-delta.c | |
parent | Merge branch 'maint-1.6.0' into maint-1.6.1 (diff) | |
download | tgif-658dd48c8572d0db49719cbef6605d384621d87c.tar.xz |
Avoid unnecessary 'lstat()' calls in 'get_stat_data()'
When we ask get_stat_data() to get the mode and size of an index entry,
we can avoid the lstat() call if we have marked the index entry as being
uptodate due to earlier lstat() calls.
This avoids a lot of unnecessary lstat() calls in eg 'git checkout',
where the last phase shows the differences to the working tree
(requiring a diff), but earlier phases have already verified the index.
On the kernel repo (with a fast machine and everything cached), this
changes timings of a nul 'git checkout' from
- Before (best of ten):
0.14user 0.05system 0:00.19elapsed 100%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (0major+13237minor)pagefaults 0swaps
- After
0.11user 0.03system 0:00.15elapsed 98%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (0major+13235minor)pagefaults 0swaps
so it can obviously be noticeable, although equally obviously it's not a
show-stopper on this particular machine. The difference is likely larger
on slower machines, or with operating systems that don't do as good a job
of name caching.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'diff-delta.c')
0 files changed, 0 insertions, 0 deletions