git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH WIP 0/3] top-level gitignore considered less harmful
@ 2012-05-26 12:31 Nguyễn Thái Ngọc Duy
  2012-05-26 12:31 ` [PATCH 1/3] Unindent excluded_from_list() Nguyễn Thái Ngọc Duy
                   ` (3 more replies)
  0 siblings, 4 replies; 14+ messages in thread
From: Nguyễn Thái Ngọc Duy @ 2012-05-26 12:31 UTC (permalink / raw)
  To: git; +Cc: Jeff King, Nguyễn Thái Ngọc Duy

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

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2012-05-29 18:21 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-05-26 12:31 [PATCH WIP 0/3] top-level gitignore considered less harmful Nguyễn Thái Ngọc Duy
2012-05-26 12:31 ` [PATCH 1/3] Unindent excluded_from_list() Nguyễn Thái Ngọc Duy
2012-05-26 12:31 ` [PATCH 2/3] exclude: do strcmp as much as possible before fnmatch Nguyễn Thái Ngọc Duy
2012-05-27  6:51   ` Junio C Hamano
2012-05-27 12:06     ` Nguyen Thai Ngoc Duy
2012-05-27 18:14       ` Junio C Hamano
2012-05-28  1:03         ` Nguyen Thai Ngoc Duy
2012-05-28  5:02         ` Junio C Hamano
2012-05-29 18:03   ` Junio C Hamano
2012-05-29 18:21     ` Thiago Farina
2012-05-26 12:31 ` [PATCH 3/3] exclude: reduce computation cost on checking dirname in patterns Nguyễn Thái Ngọc Duy
2012-05-26 13:25 ` [PATCH WIP 0/3] top-level gitignore considered less harmful Nguyen Thai Ngoc Duy
2012-05-26 21:45   ` Jeff King
2012-05-27  3:45     ` Nguyen Thai Ngoc Duy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).