While my mind is still fresh on exclude stuff, let's do something to improve the big top-level gitignore situation [1]. The last patch is the real meat, where it assumes caller calls it on a series of pathnames of the same dirname. It'll cache strcmp result of the dirname part so we only pay the cost once per pattern for all entries in the same directory. The result is not so impressive (i'm on -O0 though). Old webkit.git, before: real 0m6.418s user 0m5.561s sys 0m0.827s after: real 0m5.262s user 0m4.407s sys 0m0.850s We could approach the problem a different way instead: push back as much dirname as possible back to "(struct exclude*)->base", but I'm afraid that may mess thing up with all the pushing/popping in prep_exclude. Also about that, we should not need to call prep_exclude() on every pathname, at least when the caller is {fill,read}_directory(). There's another optimaztion we could do to pay even less. If users sort the exclude patterns, if we check dirname of one pattern and the next pattern shares the same dirname, skip comparing what we have compared again. The same can be done on "base" (even easier because we can just compare base pointer to know if they are the same) but "base" is for non-top-level gitignore. [1] http://thread.gmane.org/gmane.comp.version-control.git/194294 Nguyễn Thái Ngọc Duy (3): Unindent excluded_from_list() exclude: do strcmp as much as possible before fnmatch exclude: reduce computation cost on checking dirname in patterns dir.c | 166 ++++++++++++++++++++++++++++++++++++++++++++++-------------------- dir.h | 5 +- 2 files changed, 120 insertions(+), 51 deletions(-) -- 1.7.10.2.549.g9354186 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html