From 48045f99e574d1d8e049a413f5b3f40d33898dc2 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Fri, 25 Sep 2009 15:51:11 +0000 Subject: [PATCH] Performance improvement. --- ChangeLog | 5 +++++ implicit.c | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/ChangeLog b/ChangeLog index 9caef15..545ea53 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2009-09-25 Boris Kolpackov + * implicit.c (pattern_search): Terminate early if we haven't + found any rules to try (performance improvement). + +2009-09-25 Boris Kolpackov + * implicit.c (pattern_search): Merge three parallel arrays, TRYRULES, MATCHES, and CHECKED_LASTSLASH, into one array of struct TRYRULE. In the old version the latter two arrays diff --git a/implicit.c b/implicit.c index 6db4d0e..c3e35f7 100644 --- a/implicit.c +++ b/implicit.c @@ -390,6 +390,10 @@ pattern_search (struct file *file, int archive, } } + /* Bail out early if we haven't found any rules. */ + if (nrules == 0) + goto done; + /* If we have found a matching rule that won't match all filenames, retroactively reject any non-"terminal" rules that do always match. */ if (specific_rule_matched) -- 2.7.4