Mercurial > gnulib
changeset 18357:454e054b95a9
maint.mk: expand the prohibit_doubled_word regex
This check has a static list of words that are checked for
repetitions. Expand it before running the perl script to
avoid using expensive captures. This decreases the cost
for libvirt from 1.66s to 0.66s.
* top/maint.mk (prohibit_doubled_word_expanded_): Define.
(sc_prohibit_doubled_word): Use it.
author | Ján Tomko <jtomko@redhat.com> |
---|---|
date | Tue, 02 Aug 2016 15:41:13 +0200 |
parents | 7feee6d944f8 |
children | c1f278e4885e |
files | ChangeLog top/maint.mk |
diffstat | 2 files changed, 16 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Mon Aug 01 10:54:47 2016 -0700 +++ b/ChangeLog Tue Aug 02 15:41:13 2016 +0200 @@ -1,3 +1,13 @@ +2016-08-02 Ján Tomko <jtomko@redhat.com> + + maint.mk: expand the prohibit_doubled_word regex + This check has a static list of words that are checked for + repetitions. Expand it before running the perl script to + avoid using expensive captures. This decreases the cost + for libvirt from 1.66s to 0.66s. + * top/maint.mk (prohibit_doubled_word_expanded_): Define. + (sc_prohibit_doubled_word): Use it. + 2016-07-26 Ján Tomko <jtomko@redhat.com> useless-if-before-free: skip non-matching lines early
--- a/top/maint.mk Mon Aug 01 10:54:47 2016 -0700 +++ b/top/maint.mk Tue Aug 02 15:41:13 2016 +0200 @@ -962,8 +962,13 @@ -e ' print "$$ARGV:$$n:$$v\n";' \ -e ' }' +prohibit_doubled_words_ = \ + the then in an on if is it but for or at and do to +# expand the regex before running the check to avoid using expensive captures +prohibit_doubled_word_expanded_ = \ + $(join $(prohibit_doubled_words_),$(addprefix \s+,$(prohibit_doubled_words_))) prohibit_doubled_word_RE_ ?= \ - /\b(then?|[iao]n|i[fst]|but|f?or|at|and|[dt]o)\s+\1\b/gims + /\b(?:$(subst $(_sp),|,$(prohibit_doubled_word_expanded_)))\b/gims prohibit_doubled_word_ = \ -e 'while ($(prohibit_doubled_word_RE_))' \ $(perl_filename_lineno_text_)