1. 11 8月, 2007 7 次提交
    • L
      Optimize the two-way merge of git-read-tree too · d699676d
      Linus Torvalds 提交于
      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: NLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      d699676d
    • L
      Optimize the common cases of git-read-tree · 288f072e
      Linus Torvalds 提交于
      This optimizes bind_merge() and oneway_merge() to not unnecessarily
      remove and re-add the old index entries when they can just get replaced
      by updated ones.
      
      This makes these operations much faster for large trees (where "large"
      is in the 50,000+ file range), because we don't unnecessarily move index
      entries around in the index array all the time.
      
      Using the "bummer" tree (a test-tree with 100,000 files) we get:
      
      Before:
      	[torvalds@woody bummer]$ time git commit -m"Change one file" 50/500
      	real    0m9.470s
      	user    0m8.729s
      	sys     0m0.476s
      
      After:
      	[torvalds@woody bummer]$ time git commit -m"Change one file" 50/500
      	real    0m1.173s
      	user    0m0.720s
      	sys     0m0.452s
      
      so for large trees this is easily very noticeable indeed.
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      288f072e
    • L
      Move old index entry removal from "unpack_trees()" into the individual functions · b48d5a05
      Linus Torvalds 提交于
      This makes no changes to current code, but it allows the individual merge
      functions to decide what to do about the old entry.  They might decide to
      update it in place, rather than force them to always delete and re-add it.
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      b48d5a05
    • J
      Merge branch 'lt/readtree' · 79f5e064
      Junio C Hamano 提交于
      * lt/readtree:
        Start moving unpack-trees to "struct tree_desc"
      79f5e064
    • L
      Fix "git commit directory/" performance anomaly · 22631473
      Linus Torvalds 提交于
      This trivial patch avoids re-hashing files that are already clean in the
      index. This mirrors what commit 0781b8a9
      did for "git add .", only for "git commit ." instead.
      
      This improves the cold-cache case immensely, since we don't need to bring
      in all the file contents, just the index and any files dirty in the index.
      
      Before:
      
      	[torvalds@woody linux]$ time git commit .
      	real    1m49.537s
      	user    0m3.892s
      	sys     0m2.432s
      
      After:
      
      	[torvalds@woody linux]$ time git commit .
      	real    0m14.273s
      	user    0m1.312s
      	sys     0m0.516s
      
      (both after doing a "echo 3 > /proc/sys/vm/drop_caches" to get cold-cache
      behaviour - even with the index optimization git still has to "lstat()"
      all the files, so with a truly cold cache, bringing all the inodes in
      will take some time).
      
      [jc: trivial "return 0;" fixed]
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      22631473
    • J
      Optimize "diff --cached" performance. · af3785dc
      Junio C Hamano 提交于
      The read_tree() function is called only from the call chain to
      run "git diff --cached" (this includes the internal call made by
      git-runstatus to run_diff_index()).  The function vacates stage
      without any funky "merge" magic.  The caller then goes and
      compares stage #1 entries from the tree with stage #0 entries
      from the original index.
      
      When adding the cache entries this way, it used the general
      purpose add_cache_entry().  This function looks for an existing
      entry to replace or if there is none to find where to insert the
      new entry, resolves D/F conflict and all the other things.
      
      For the purpose of reading entries into an empty stage, none of
      that processing is needed.  We can instead append everything and
      then sort the result at the end.
      
      This commit changes read_tree() to first make sure that there is
      no existing cache entries at specified stage, and if that is the
      case, it runs add_cache_entry() with ADD_CACHE_JUST_APPEND flag
      (new), and then sort the resulting cache using qsort().
      
      This new flag tells add_cache_entry() to omit all the checks
      such as "Does this path already exist?  Does adding this path
      remove other existing entries because it turns a directory to a
      file?" and instead append the given cache entry straight at the
      end of the active cache.  The caller of course is expected to
      sort the resulting cache at the end before using the result.
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      af3785dc
    • J
      Revert "tweak manpage formatting" · 63c21c49
      Junio C Hamano 提交于
      This reverts commit 524e5ffc.
      It is reported that this change breaks formatting with docbook
      1.69.
      63c21c49
  2. 10 8月, 2007 10 次提交
  3. 09 8月, 2007 3 次提交
  4. 08 8月, 2007 3 次提交
  5. 07 8月, 2007 6 次提交
  6. 06 8月, 2007 11 次提交