1. 07 Oct, 2011 5 commits
  2. 21 Aug, 2011 1 commit
    • Fredrik K's avatar
      Use kwset in pickaxe · b95c5ada
      Fredrik K authored
      Benchmarks in the hot cache case:
      
      before:
      $ perf stat --repeat=5 git log -Sqwerty
      
      Performance counter stats for 'git log -Sqwerty' (5 runs):
      
             47,092,744 cache-misses             #      2.825 M/sec   ( +-   1.607% )
            123,368,389 cache-references         #      7.400 M/sec   ( +-   0.812% )
            330,040,998 branch-misses            #      3.134 %       ( +-   0.257% )
         10,530,896,750 branches                 #    631.663 M/sec   ( +-   0.121% )
         62,037,201,030 instructions             #      1.399 IPC     ( +-   0.142% )
         44,331,294,321 cycles                   #   2659.073 M/sec   ( +-   0.326% )
                 96,794 page-faults              #      0.006 M/sec   ( +-  11.952% )
                     25 CPU-migrations           #      0.000 M/sec   ( +-  25.266% )
                  1,424 context-switches         #      0.000 M/sec   ( +-   0.540% )
           16671.708650 task-clock-msecs         #      0.997 CPUs    ( +-   0.343% )
      
            16.728692052  seconds time elapsed   ( +-   0.344% )
      
      after:
      $ perf stat --repeat=5 git log -Sqwerty
      
      Performance counter stats for 'git log -Sqwerty' (5 runs):
      
             51,385,522 cache-misses             #      4.619 M/sec   ( +-   0.565% )
            129,177,880 cache-references         #     11.611 M/sec   ( +-   0.219% )
            319,222,775 branch-misses            #      6.946 %       ( +-   0.134% )
          4,595,913,233 branches                 #    413.086 M/sec   ( +-   0.112% )
         31,395,042,533 instructions             #      1.062 IPC     ( +-   0.129% )
         29,558,348,598 cycles                   #   2656.740 M/sec   ( +-   0.204% )
                 93,224 page-faults              #      0.008 M/sec   ( +-   4.487% )
                     19 CPU-migrations           #      0.000 M/sec   ( +-  10.425% )
                    950 context-switches         #      0.000 M/sec   ( +-   0.360% )
           11125.796039 task-clock-msecs         #      0.997 CPUs    ( +-   0.239% )
      
            11.164216599  seconds time elapsed   ( +-   0.240% )
      
      So the kwset code is about 33% faster.
      Signed-off-by: Fredrik K's avatarFredrik Kuivinen <[email protected]>
      Signed-off-by: default avatarJunio C Hamano <[email protected]>
      b95c5ada
  3. 06 Oct, 2010 1 commit
  4. 05 Oct, 2010 1 commit
  5. 31 Aug, 2010 2 commits
    • Junio C Hamano's avatar
      git log/diff: add -G<regexp> that greps in the patch text · f506b8e8
      Junio C Hamano authored
      Teach "-G<regexp>" that is similar to "-S<regexp> --pickaxe-regexp" to the
      "git diff" family of commands.  This limits the diff queue to filepairs
      whose patch text actually has an added or a deleted line that matches the
      given regexp.  Unlike "-S<regexp>", changing other parts of the line that
      has a substring that matches the given regexp IS counted as a change, as
      such a change would appear as one deletion followed by one addition in a
      patch text.
      
      Unlike -S (pickaxe) that is intended to be used to quickly detect a commit
      that changes the number of occurrences of hits between the preimage and
      the postimage to serve as a part of larger toolchain, this is meant to be
      used as the top-level Porcelain feature.
      
      The implementation unfortunately has to run "diff" twice if you are
      running "log" family of commands to produce patches in the final output
      (e.g. "git log -p" or "git format-patch").  I think we _could_ cache the
      result in-core if we wanted to, but that would require larger surgery to
      the diffcore machinery (i.e. adding an extra pointer in the filepair
      structure to keep a pointer to a strbuf around, stuff the textual diff to
      the strbuf inside diffgrep_consume(), and make use of it in later stages
      when it is available) and it may not be worth it.
      Signed-off-by: default avatarJunio C Hamano <[email protected]>
      f506b8e8
    • Junio C Hamano's avatar
      diff: pass the entire diff-options to diffcore_pickaxe() · 382f013b
      Junio C Hamano authored
      That would make it easier to give enhanced feature to the
      pickaxe transformation.
      Signed-off-by: default avatarJunio C Hamano <[email protected]>
      382f013b
  6. 07 May, 2010 1 commit
  7. 22 Mar, 2009 1 commit
    • René Scharfe's avatar
      pickaxe: count regex matches only once · 7ad3c52e
      René Scharfe authored
      When --pickaxe-regex is used, forward past the end of matches instead of
      advancing to the byte after their start.  This way matches count only
      once, even if the regular expression matches their tail -- like in the
      fixed-string fork of the code.
      
      E.g.: /.*/ used to count the number of bytes instead of the number of
      lines.  /aa/ resulted in a count of two in "aaa" instead of one.
      
      Also document the fact that regexec() needs a NUL-terminated string as
      its second argument by adding an assert().
      Signed-off-by: default avatarRene Scharfe <[email protected]>
      Signed-off-by: default avatarJunio C Hamano <[email protected]>
      7ad3c52e
  8. 17 Mar, 2009 1 commit
    • René Scharfe's avatar
      pickaxe: count regex matches only once · 50fd6997
      René Scharfe authored
      When --pickaxe-regex is used, forward past the end of matches instead of
      advancing to the byte after their start.  This way matches count only
      once, even if the regular expression matches their tail -- like in the
      fixed-string fork of the code.
      
      E.g.: /.*/ used to count the number of bytes instead of the number of
      lines.  /aa/ resulted in a count of two in "aaa" instead of one.
      
      Also document the fact that regexec() needs a NUL-terminated string as
      its second argument by adding an assert().
      Signed-off-by: default avatarRene Scharfe <[email protected]>
      Signed-off-by: default avatarJunio C Hamano <[email protected]>
      50fd6997
  9. 03 Mar, 2009 1 commit
    • René Scharfe's avatar
      diffcore-pickaxe: use memmem() · ce163c79
      René Scharfe authored
      Use memmem() instead of open-coding it.  The system libraries usually have a
      much faster version than the memcmp()-loop here.  Even our own fall-back in
      compat/, which is used on Windows, is slightly faster.
      
      The following commands were run in a Linux kernel repository and timed, the
      best of five results is shown:
      
        $ STRING='Ensure that the real time constraints are schedulable.'
        $ git log -S"$STRING" HEAD -- kernel/sched.c >/dev/null
      
      On Ubuntu 8.10 x64, before (v1.6.2-rc2):
      
        8.09user 0.04system 0:08.14elapsed 99%CPU (0avgtext+0avgdata 0maxresident)k
        0inputs+0outputs (0major+30952minor)pagefaults 0swaps
      
      And with the patch:
      
        1.50user 0.04system 0:01.54elapsed 100%CPU (0avgtext+0avgdata 0maxresident)k
        0inputs+0outputs (0major+30645minor)pagefaults 0swaps
      
      On Fedora 10 x64, before:
      
        8.34user 0.05system 0:08.39elapsed 99%CPU (0avgtext+0avgdata 0maxresident)k
        0inputs+0outputs (0major+29268minor)pagefaults 0swaps
      
      And with the patch:
      
        1.15user 0.05system 0:01.20elapsed 99%CPU (0avgtext+0avgdata 0maxresident)k
        0inputs+0outputs (0major+32253minor)pagefaults 0swaps
      
      On Windows Vista x64, before:
      
        real    0m9.204s
        user    0m0.000s
        sys     0m0.000s
      
      And with the patch:
      
        real    0m8.470s
        user    0m0.000s
        sys     0m0.000s
      Signed-off-by: default avatarRene Scharfe <[email protected]>
      Signed-off-by: default avatarJunio C Hamano <[email protected]>
      ce163c79
  10. 07 Jun, 2007 1 commit
    • Junio C Hamano's avatar
      War on whitespace · a6080a0a
      Junio C Hamano authored
      This uses "git-apply --whitespace=strip" to fix whitespace errors that have
      crept in to our source files over time.  There are a few files that need
      to have trailing whitespaces (most notably, test vectors).  The results
      still passes the test, and build result in Documentation/ area is unchanged.
      Signed-off-by: default avatarJunio C Hamano <[email protected]>
      a6080a0a
  11. 07 May, 2007 1 commit
  12. 26 Jan, 2007 1 commit
    • Jeff King's avatar
      diffcore-pickaxe: fix infinite loop on zero-length needle · e1b16116
      Jeff King authored
      The "contains" algorithm runs into an infinite loop if the needle string
      has zero length. The loop could be modified to handle this, but it makes
      more sense to simply have an empty needle return no matches. Thus, a
      command like
        git log -S
      produces no output.
      
      We place the check at the top of the function so that we get the same
      results with or without --pickaxe-regex. Note that until now,
        git log -S --pickaxe-regex
      would match everything, not nothing.
      
      Arguably, an empty pickaxe string should simply produce an error
      message; however, this is still a useful assertion to add to the
      algorithm at this layer of the code.
      
      Noticed by Bill Lear.
      Signed-off-by: default avatarJeff King <[email protected]>
      Signed-off-by: default avatarJunio C Hamano <[email protected]>
      e1b16116
  13. 20 Dec, 2006 1 commit
    • Junio C Hamano's avatar
      simplify inclusion of system header files. · 85023577
      Junio C Hamano authored
      This is a mechanical clean-up of the way *.c files include
      system header files.
      
       (1) sources under compat/, platform sha-1 implementations, and
           xdelta code are exempt from the following rules;
      
       (2) the first #include must be "git-compat-util.h" or one of
           our own header file that includes it first (e.g. config.h,
           builtin.h, pkt-line.h);
      
       (3) system headers that are included in "git-compat-util.h"
           need not be included in individual C source files.
      
       (4) "git-compat-util.h" does not have to include subsystem
           specific header files (e.g. expat.h).
      Signed-off-by: default avatarJunio C Hamano <[email protected]>
      85023577
  14. 05 Apr, 2006 1 commit
  15. 04 Apr, 2006 1 commit
    • Petr Baudis's avatar
      Support for pickaxe matching regular expressions · d01d8c67
      Petr Baudis authored
      git-diff-* --pickaxe-regex will change the -S pickaxe to match
      POSIX extended regular expressions instead of fixed strings.
      
      The regex.h library is a rather stupid interface and I like pcre too, but
      with any luck it will be everywhere we will want to run Git on, it being
      POSIX.2 and all. I'm not sure if we can expect platforms like AIX to
      conform to POSIX.2 or if win32 has regex.h. We might add a flag to
      Makefile if there is a portability trouble potential.
      Signed-off-by: default avatarPetr Baudis <[email protected]>
      d01d8c67
  16. 24 Jul, 2005 1 commit
  17. 29 May, 2005 4 commits
  18. 23 May, 2005 2 commits
    • Junio C Hamano's avatar
      [PATCH] Performance fix for pickaxe. · 046aa644
      Junio C Hamano authored
      The pickaxe was expanding the blobs and searching in them even
      when it should have already known that both sides are the same.
      Signed-off-by: default avatarJunio C Hamano <[email protected]>
      Signed-off-by: default avatarLinus Torvalds <[email protected]>
      046aa644
    • Junio C Hamano's avatar
      [PATCH] Rename/copy detection fix. · f7c1512a
      Junio C Hamano authored
      The rename/copy detection logic in earlier round was only good
      enough to show patch output and discussion on the mailing list
      about the diff-raw format updates revealed many problems with
      it.  This patch fixes all the ones known to me, without making
      things I want to do later impossible, mostly related to patch
      reordering.
      
       (1) Earlier rename/copy detector determined which one is rename
           and which one is copy too early, which made it impossible
           to later introduce diffcore transformers to reorder
           patches.  This patch fixes it by moving that logic to the
           very end of the processing.
      
       (2) Earlier output routine diff_flush() was pruning all the
           "no-change" entries indiscriminatingly.  This was done due
           to my false assumption that one of the requirements in the
           diff-raw output was not to show such an entry (which
           resulted in my incorrect comment about "diff-helper never
           being able to be equivalent to built-in diff driver").  My
           special thanks go to Linus for correcting me about this.
           When we produce diff-raw output, for the downstream to be
           able to tell renames from copies, sometimes it _is_
           necessary to output "no-change" entries, and this patch
           adds diffcore_prune() function for doing it.
      
       (3) Earlier diff_filepair structure was trying to be not too
           specific about rename/copy operations, but the purpose of
           the structure was to record one or two paths, which _was_
           indeed about rename/copy.  This patch discards xfrm_msg
           field which was trying to be generic for this wrong reason,
           and introduces a couple of fields (rename_score and
           rename_rank) that are explicitly specific to rename/copy
           logic.  One thing to note is that the information in a
           single diff_filepair structure _still_ does not distinguish
           renames from copies, and it is deliberately so.  This is to
           allow patches to be reordered in later stages.
      
       (4) This patch also adds some tests about diff-raw format
           output and makes sure that necessary "no-change" entries
           appear on the output.
      Signed-off-by: default avatarJunio C Hamano <[email protected]>
      Signed-off-by: default avatarLinus Torvalds <[email protected]>
      f7c1512a
  19. 22 May, 2005 3 commits
  20. 21 May, 2005 1 commit
    • Junio C Hamano's avatar
      [PATCH] Introducing software archaeologist's tool "pickaxe". · 52e95789
      Junio C Hamano authored
      This steals the "pickaxe" feature from JIT and make it available
      to the bare Plumbing layer.  From the command line, the user
      gives a string he is intersted in.
      
      Using the diff-core infrastructure previously introduced, it
      filters the differences to limit the output only to the diffs
      between <src> and <dst> where the string appears only in one but
      not in the other.  For example:
      
       $ ./git-rev-list HEAD | ./git-diff-tree -Sdiff-tree-helper --stdin -M
      
      would show the diffs that touch the string "diff-tree-helper".
      
      In real software-archaeologist application, you would typically
      look for a few to several lines of code and see where that code
      came from.
      
      The "pickaxe" module runs after "rename/copy detection" module,
      so it even crosses the file rename boundary, as the above
      example demonstrates.
      Signed-off-by: default avatarJunio C Hamano <[email protected]>
      Signed-off-by: default avatarLinus Torvalds <[email protected]>
      52e95789