Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/git/blob/master/t/perf/p7820-grep-engines.sh # git [Ported from github.com/git/git] Sync with Git 2.56.1 Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `master` Branches Tags History `git / t / perf / p7820-grep-engines.sh` 90 lines · 2170 bytes Raw Blame History 1 #!/bin/sh 2 3 test_description="Comparison of git-grep's regex engines 4 5 Set GIT_PERF_7820_GREP_OPTS in the environment to pass options to 6 git-grep. Make sure to include a leading space, 7 e.g. GIT_PERF_7820_GREP_OPTS=' -i'. Some options to try: 8 9 -i 10 -w 11 -v 12 -vi 13 -vw 14 -viw 15 16 If GIT_PERF_GREP_THREADS is set to a list of threads (e.g. '1 4 8' 17 etc.) we will test the patterns under those numbers of threads. 18 " 19 20 . ./perf-lib.sh 21 22 test_perf_large_repo 23 test_checkout_worktree 24 25 if test -n "$GIT_PERF_GREP_THREADS" 26 then 27 test_set_prereq PERF_GREP_ENGINES_THREADS 28 fi 29 30 for pattern in \ 31 'how.to' \ 32 '^how to' \ 33 '[how] to' \ 34 '\(e.t[^ ]*\|v.ry\) rare' \ 35 'm\(ú\|u\)lt.b\(æ\|y\)te' 36 do 37 for engine in basic extended perl 38 do 39 if test $engine != "basic" 40 then 41 # Poor man's basic -> extended converter. 42 pattern=$(echo "$pattern" | sed 's/\\//g') 43 fi 44 if test $engine = "perl" && ! test_have_prereq PCRE 45 then 46 prereq="PCRE" 47 else 48 prereq="" 49 fi 50 if ! test_have_prereq PERF_GREP_ENGINES_THREADS 51 then 52 test_perf "$engine grep$GIT_PERF_7820_GREP_OPTS '$pattern'" \ 53 --prereq "$prereq" " 54 git -c grep.patternType=$engine grep$GIT_PERF_7820_GREP_OPTS -- '$pattern' >'out.$engine' || : 55 " 56 else 57 for threads in $GIT_PERF_GREP_THREADS 58 do 59 test_perf "$engine grep$GIT_PERF_7820_GREP_OPTS '$pattern' with $threads threads" 60 --prereq PTHREADS,$prereq " 61 git -c grep.patternType=$engine -c grep.threads=$threads grep$GIT_PERF_7820_GREP_OPTS -- '$pattern' >'out.$engine.$threads' || : 62 " 63 done 64 fi 65 done 66 67 if ! test_have_prereq PERF_GREP_ENGINES_THREADS 68 then 69 test_expect_success "assert that all engines found the same for$GIT_PERF_7820_GREP_OPTS '$pattern'" ' 70 test_cmp out.basic out.extended && 71 if test_have_prereq PCRE 72 then 73 test_cmp out.basic out.perl 74 fi 75 ' 76 else 77 for threads in $GIT_PERF_GREP_THREADS 78 do 79 test_expect_success PTHREADS "assert that all engines found the same for$GIT_PERF_7820_GREP_OPTS '$pattern' under threading" " 80 test_cmp out.basic.$threads out.extended.$threads && 81 if test_have_prereq PCRE 82 then 83 test_cmp out.basic.$threads out.perl.$threads 84 fi 85 " 86 done 87 fi 88 done 89 90 test_done