[PATCH/RFC v1 0/6] git checkout: more cleanups, optimisation, less lstat() calls
- From
- Kjetil Barvik <barvik@broadpark.no>
- Date
- Jan 26, 2009, 21:17 UTC
- Message-ID
- <1233004637-15112-1-git-send-email-barvik@broadpark.no>
Here is 6 small patches which should further improve the time it take to do 'git checkout'. After the 6 patches, the numbers from the 'git checkout -q my-v2.6.27' test, should now look like this:
TOTAL 136752 100.000% OK:124567 NOT: 12185 8.641698 sec 63 usec/call
lstat64 55502 40.586% OK: 49122 NOT: 6380 2.463762 sec 44 usec/call
strings 55502 tot 30163 uniq 1.840 /uniq 2.463762 sec 44 usec/call
files 47122 tot 23813 uniq 1.979 /uniq 2.070486 sec 44 usec/call
dirs 2000 tot 1436 uniq 1.393 /uniq 0.087281 sec 44 usec/call
errors 6380 tot 5187 uniq 1.230 /uniq 0.305995 sec 48 usec/call
4 0.007% OK: 3 NOT: 1 "arch/sh/boards"
3 0.005% OK: 3 NOT: 0 ".git/HEAD"
3 0.005% OK: 3 NOT: 0 ".git/refs/heads/my-v2.6.27"
3 0.005% OK: 3 NOT: 0 ".gitignore"
3 0.005% OK: 3 NOT: 0 ".mailmap"
3 0.005% OK: 3 NOT: 0 "CREDITS"
3 0.005% OK: 3 NOT: 0 "Documentation"
3 0.005% OK: 3 NOT: 0 "Documentation/00-INDEX"
3 0.005% OK: 3 NOT: 0 "Documentation/ABI/testing/sysfs-block"
3 0.005% OK: 3 NOT: 0 "Documentation/ABI/testing/sysfs-firmware-acpi"
3 0.005% OK: 3 NOT: 0 "Documentation/CodingStyle"
3 0.005% OK: 3 NOT: 0 "Documentation/DMA-API.txt"
3 0.005% OK: 3 NOT: 0 "Documentation/DMA-mapping.txt"
3 0.005% OK: 3 NOT: 0 "Documentation/DocBook/Makefile"
3 0.005% OK: 3 NOT: 0 "Documentation/DocBook/gadget.tmpl"
3 0.005% OK: 3 NOT: 0 "Documentation/DocBook/kernel-api.tmpl"
3 0.005% OK: 3 NOT: 0 "Documentation/DocBook/kernel-locking.tmpl"
3 0.005% OK: 3 NOT: 0 "Documentation/DocBook/procfs-guide.tmpl"
3 0.005% OK: 3 NOT: 0 "Documentation/DocBook/procfs_example.c"
3 0.005% OK: 3 NOT: 0 "Documentation/DocBook/rapidio.tmpl"
<snipp>
fstat64 14403 10.532% OK: 14403 NOT: 0 0.179938 sec 12 usec/callSo, since last time, and because of patch 4/6, almost 14 400 of the lstat() calls has now become fstat() calls, and it seems we have saved (* 14403 (- 44 12)) = 460 896 microseconds system time because of this. I am planing to do a more complete and long-running /usr/bin/time test, to get real numbers.
With both patch-series, the count of lstat() calls for this particular test have dropped from 120 954 to 55 502, which is a total reduction of 65 452 calls or 54%.
Please note that patch 6/6 is only to be a debug patch, to catch a possible ping-pong situation inside the lstat_cache(), so I think that it should at _most_ be merged to the pu branch, such that people who wish to test, can 'git cherry-pick' the patch from there.
Kjetil Barvik (6): symlinks.c: small cleanup and optimisation remove some memcpy() and strchr() calls inside create_directories() cleanup of write_entry() in entry.c use fstat() instead of lstat() when we have an opened file combine-diff.c: remove a call to fstat() inside show_patch_diff() lstat_cache(): print a warning if doing ping-pong between cache types
combine-diff.c | 5 +- entry.c | 144 ++++++++++++++++++++++++++++++-------------------------- symlinks.c | 48 ++++++++++++++----- 3 files changed, 115 insertions(+), 82 deletions(-)