diff options
author | Nguyễn Thái Ngọc Duy <pclouds@gmail.com> | 2012-11-24 11:33:51 +0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2012-11-26 11:16:34 -0800 |
commit | c904cd89e4328c0b5041b6ee0bb2df32459a33a2 (patch) | |
tree | 7ffe77166543e60ce97327090b3907ef820c3c19 /builtin/remote.c | |
parent | pathspec: apply "*.c" optimization from exclude (diff) | |
download | tgif-c904cd89e4328c0b5041b6ee0bb2df32459a33a2.tar.xz |
tree_entry_interesting: do basedir compare on wildcard patterns when possible
Currently we treat "*.c" and "path/to/*.c" the same way. Which means
we check all possible paths in repo against "path/to/*.c". One could
see that "path/elsewhere/foo.c" obviously cannot match "path/to/*.c"
and we only need to check all paths _inside_ "path/to/" against that
pattern.
This patch checks the leading fixed part of a pathspec against base
directory and exit early if possible. We could even optimize further
in "path/to/something*.c" case (i.e. check the fixed part against
name_entry as well) but that's more complicated and probably does not
gain us much.
-O2 build on linux-2.6, without and with this patch respectively:
$ time git rev-list --quiet HEAD -- 'drivers/*.c'
real 1m9.484s
user 1m9.128s
sys 0m0.181s
$ time ~/w/git/git rev-list --quiet HEAD -- 'drivers/*.c'
real 0m15.710s
user 0m15.564s
sys 0m0.107s
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/remote.c')
0 files changed, 0 insertions, 0 deletions