mirror of
https://github.com/git/git
synced 2024-10-30 14:03:28 +00:00
acabd2048e
When UTF is enabled for a PCRE match, the corresponding flags are added to the pcre2_compile() call, but PCRE2_UCP wasn't included. This prevents extending the meaning of the character classes to include those new valid characters and therefore result in failed matches for expressions that rely on that extention, for ex: $ git grep -P '\bÆvar' Add PCRE2_UCP so that \w will include Æ and therefore \b could correctly match the beginning of that word. This has an impact on performance that has been estimated to be between 20% to 40% and that is shown through the added performance test. Signed-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com> Acked-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
42 lines
807 B
Bash
Executable file
42 lines
807 B
Bash
Executable file
#!/bin/sh
|
|
|
|
test_description="git-grep's perl regex
|
|
|
|
If GIT_PERF_GREP_THREADS is set to a list of threads (e.g. '1 4 8'
|
|
etc.) we will test the patterns under those numbers of threads.
|
|
"
|
|
|
|
. ./perf-lib.sh
|
|
|
|
test_perf_large_repo
|
|
test_checkout_worktree
|
|
|
|
if test -n "$GIT_PERF_GREP_THREADS"
|
|
then
|
|
test_set_prereq PERF_GREP_ENGINES_THREADS
|
|
fi
|
|
|
|
for pattern in \
|
|
'\\bhow' \
|
|
'\\bÆvar' \
|
|
'\\d+ \\bÆvar' \
|
|
'\\bBelón\\b' \
|
|
'\\w{12}\\b'
|
|
do
|
|
echo '$pattern' >pat
|
|
if ! test_have_prereq PERF_GREP_ENGINES_THREADS
|
|
then
|
|
test_perf "grep -P '$pattern'" --prereq PCRE "
|
|
git -P grep -f pat || :
|
|
"
|
|
else
|
|
for threads in $GIT_PERF_GREP_THREADS
|
|
do
|
|
test_perf "grep -P '$pattern' with $threads threads" --prereq PTHREADS,PCRE "
|
|
git -c grep.threads=$threads -P grep -f pat || :
|
|
"
|
|
done
|
|
fi
|
|
done
|
|
|
|
test_done
|