git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH/RFC v2 0/7] git checkout: more cleanups, optimisation, less lstat() calls

From
KBKjetil Barvik <barvik@broadpark.no>
Date
Feb 1, 2009, 20:23 UTC
Message-ID
<cover.1233499703.git.barvik@broadpark.no>
Changes since v1

--- patch 1/7 --- Kept the "match_len >= cache.len" trick only inside the longest_match_lstat_cache() function. Also removed the arguments to reset_lstat_cache()

--- patch 2/7 --- Applied all comments from Junio

--- patch 3/7 --- Kept long format strings in printf() calls, even if source lines get longer than 80 chars. The patch touch less source lines because of this.

--- patch 4/7 --- Added sanity check to the if-test under which fstat() is called.

--- patch 5/7 --- Updated commit log message

--- patch 7/7 --- New patch which reduces the number of rmdir() calls significantly. When tested with 'git chekcout -q my-v2.6.27' (checkout from Linux v2.6.25 to v2.6.27), the numbers look like this before this patch:

rmdir          4532   3.314% OK:   174 NOT:  4358   0.263268 sec   58 usec/call
    strings    4532 tot    354 uniq  12.802 /uniq   0.263268 sec   58 usec/call
    errors     4358 tot    347 uniq  12.559 /uniq   0.249116 sec   57 usec/call
                233   5.141% OK:     1 NOT:   232  "include/asm-powerpc"
                187   4.126% OK:     1 NOT:   186  "include/asm-sh"
                172   3.795% OK:     0 NOT:   172  "include/asm-arm"
                169   3.729% OK:     1 NOT:   168  "include/asm-sparc64"
                161   3.553% OK:     1 NOT:   160  "include/asm-sparc"
                144   3.177% OK:     1 NOT:   143  "include/asm-ia64"
                143   3.155% OK:     1 NOT:   142  "include/asm-m68knommu"
                133   2.935% OK:     1 NOT:   132  "include/asm-alpha"
                126   2.780% OK:     1 NOT:   125  "include/asm-s390"
                122   2.692% OK:     1 NOT:   121  "include/asm-v850"
Notice the nice change in the top 10 list after this patch:
rmdir           331   0.255% OK:   174 NOT:   157   0.033435 sec  101 usec/call
    strings     331 tot    331 uniq   1.000 /uniq   0.033435 sec  101 usec/call
    errors      157 tot    157 uniq   1.000 /uniq   0.016300 sec  104 usec/call
                  1   0.302% OK:     0 NOT:     1  "Documentation"
                  1   0.302% OK:     0 NOT:     1  "Documentation/filesystems/configfs"
                  1   0.302% OK:     0 NOT:     1  "Documentation/firmware_class"
                  1   0.302% OK:     1 NOT:     0  "Documentation/hrtimer"
                  1   0.302% OK:     1 NOT:     0  "Documentation/hrtimers"
                  1   0.302% OK:     0 NOT:     1  "Documentation/i2c/busses"
                  1   0.302% OK:     1 NOT:     0  "Documentation/i386"
                  1   0.302% OK:     0 NOT:     1  "Documentation/networking"
                  1   0.302% OK:     0 NOT:     1  "Documentation/power"
                  1   0.302% OK:     0 NOT:     1  "Documentation/powerpc"
Kjetil Barvik (7):
  symlinks.c: small cleanup and optimisation
  remove some memcpy() and strchr() calls inside create_directories()
  cleanup of write_entry() in entry.c
  write_entry(): use fstat() instead of lstat() when file is open
  combine-diff.c: remove a call to fstat() inside show_patch_diff()
  lstat_cache(): print a warning if doing ping-pong between cache types
  unpack-trees.c: introduce schedule_dir_for_removal()
 combine-diff.c |    4 +--
 entry.c        |  106 +++++++++++++++++++++++++++-----------------------------
 symlinks.c     |   67 +++++++++++++++++++++++++----------
 unpack-trees.c |   97 ++++++++++++++++++++++++++++++++++++++-------------
 4 files changed, 172 insertions(+), 102 deletions(-)
Next: Kjetil Barvik
Message 1 of 8 in “git checkout: more cleanups, optimisation, less lstat() calls”
  1. 0/7 git checkout: more cleanups, optimisation, less lstat() callsKjetil Barvik, Feb 1, 2009
  2. 1/7 symlinks.c: small cleanup and optimisationKjetil Barvik, Feb 1, 2009
  3. 2/7 remove some memcpy() and strchr() calls inside create_directories()Kjetil Barvik, Feb 1, 2009
  4. 3/7 cleanup of write_entry() in entry.cKjetil Barvik, Feb 1, 2009
  5. 4/7 write_entry(): use fstat() instead of lstat() when file is openKjetil Barvik, Feb 1, 2009
  6. 5/7 combine-diff.c: remove a call to fstat() inside show_patch_diff()Kjetil Barvik, Feb 1, 2009
  7. 6/7 lstat_cache(): print a warning if doing ping-pong between cache typesKjetil Barvik, Feb 1, 2009
  8. 7/7 unpack-trees.c: introduce schedule_dir_for_removal()Kjetil Barvik, Feb 1, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.