Skip to content

Exclude optimizations

Nguyễn Thái Ngọc Duy git 2 versions In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest13 patches 5 repliesIn review
  2. v26 patches 14 repliesSuperseded

Patches in v3 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/13dir.c: add MEASURE_EXCLUDE code for tracking exclude performancedir.c+100 -90 replies
2/13match_pathname: avoid calling strncmp if baselen is 0dir.c+2 -20 replies
3/13dir.c: inline convenient *_icase helpersdir.c dir.h+15 -190 replies
4/13match_basename: use strncmp instead of strcmpattr.c dir.c+7 -32 replies
5/13match_{base,path}name: replace strncmp_icase with memequal_icasedir.c+27 -41 reply
6/13dir: pass pathname length to last_exclude_matchingdir.c+9 -60 replies
7/13exclude: avoid calling prep_exclude on entries of the same directorydir.c dir.h+10 -10 replies
8/13exclude: record baselen in the patternattr.c dir.c dir.h+22 -70 replies
9/13exclude: filter out patterns not applicable to the current directorydir.c dir.h+92 -21 reply
10/13read_directory: avoid invoking exclude machinery on tracked filesdir.c+53 -270 replies
11/13Preallocate hash tables when the number of inserts are known in advancediffcore-rename.c hash.h name-hash.c+9 -00 replies
12/13name-hash: allow to lookup a name with precalculated base hashMakefile cache.h dir.c +4 more+71 -280 replies
13/13read_directory: calculate name hashes incrementallydir.c+33 -110 replies

Reviews trailers per patch

None of the 13 patches has a Reviewed-by or Acked-by.

PatchKarsten Blees
1/13
2/13
3/13
4/13
5/13
6/13
7/13
8/13
9/13
10/13Tracked-down-by
11/13
12/13
13/13

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v3 thread

Cover letter [PATCH v3 00/13] Exclude optimizations

Result of today. I cherry-picked nd/read-directory-recursive-optim to see how far I can get after pulling all the tricks. This is a slower machine so time is longer. Anyway, read_directory time is reduced about 70% in the end.

function before after
----------------------------------

treat_leading_path:   0.000  0.000
read_directory:       4.102  1.235
+treat_one_path:      2.843  0.531
++is_excluded:        2.632  0.102
+++prep_exclude:      0.225  0.040
+++matching:          2.054  0.035
++dir_exist:          0.035  0.035
++index_name_exists:  0.292  0.225
lazy_init_name_hash:  0.258  0.155
+simplify_away:       0.085  0.083
+dir_add_name:        0.446  0.000

I don't expect all these patches to go in. The meat is nd/read-directory-recursive-optim (or 10/13) and 09/13. Some other patches are safe even if they do not contribute much to the gain. The last two are probably not worth the trouble.

Nguyễn Thái Ngọc Duy (13):
dir.c: add MEASURE_EXCLUDE code for tracking exclude performance
match_pathname: avoid calling strncmp if baselen is 0 dir.c: inline convenient *_icase helpers
match_basename: use strncmp instead of strcmp match_{base,path}name: replace strncmp_icase with memequal_icase
dir: pass pathname length to last_exclude_matching
exclude: avoid calling prep_exclude on entries of the same directory
exclude: record baselen in the pattern
exclude: filter out patterns not applicable to the current directory
read_directory: avoid invoking exclude machinery on tracked files Preallocate hash tables when the number of inserts are known in advance
name-hash: allow to lookup a name with precalculated base hash
read_directory: calculate name hashes incrementally

 Makefile          |   1 +
 attr.c            |   6 +-
 cache.h           |   2 -
 diffcore-rename.c |   1 +
 dir.c             | 392 ++++++++++++++++++++++++++++++++++++++++++++----------
 dir.h             |  26 +++-
 hash.h            |   7 +
 name-hash.c       |  49 ++++---
 name-hash.h (new) |  45 +++++++
 read-cache.c      |   1 +
 unpack-trees.c    |   1 +
 11 files changed, 431 insertions(+), 100 deletions(-)
 create mode 100644 name-hash.h
Signature · 1 line
1.8.1.2.536.gf441e6d