| 1 | #!/bin/sh |
| 2 | |
| 3 | test_description="Test pickaxe performance" |
| 4 | |
| 5 | . ./perf-lib.sh |
| 6 | |
| 7 | test_perf_default_repo |
| 8 | |
| 9 | # Not --max-count, as that's the number of matching commit, so it's |
| 10 | # unbounded. We want to limit our revision walk here. |
| 11 | from_rev_desc= |
| 12 | from_rev= |
| 13 | max_count=1000 |
| 14 | if test_have_prereq EXPENSIVE |
| 15 | then |
| 16 | max_count=10000 |
| 17 | fi |
| 18 | from_rev=" $(git rev-list HEAD | head -n $max_count | tail -n 1).." |
| 19 | from_rev_desc=" <limit-rev>.." |
| 20 | |
| 21 | for icase in \ |
| 22 | '' \ |
| 23 | '-i ' |
| 24 | do |
| 25 | # -S (no regex) |
| 26 | for pattern in \ |
| 27 | 'int main' \ |
| 28 | 'æ' |
| 29 | do |
| 30 | for opts in \ |
| 31 | '-S' |
| 32 | do |
| 33 | test_perf "git log $icase$opts'$pattern'$from_rev_desc" " |
| 34 | git log --pretty=format:%H $icase$opts'$pattern'$from_rev |
| 35 | " |
| 36 | done |
| 37 | done |
| 38 | |
| 39 | # -S (regex) |
| 40 | for pattern in \ |
| 41 | '(int|void|null)' \ |
| 42 | 'if *\([^ ]+ & ' \ |
| 43 | '[àáâãäåæñøùúûüýþ]' |
| 44 | do |
| 45 | for opts in \ |
| 46 | '--pickaxe-regex -S' |
| 47 | do |
| 48 | test_perf "git log $icase$opts'$pattern'$from_rev_desc" " |
| 49 | git log --pretty=format:%H $icase$opts'$pattern'$from_rev |
| 50 | " |
| 51 | done |
| 52 | done |
| 53 | |
| 54 | # -G |
| 55 | for pattern in \ |
| 56 | '(int|void|null)' \ |
| 57 | 'if *\([^ ]+ & ' \ |
| 58 | '[àáâãäåæñøùúûüýþ]' |
| 59 | do |
| 60 | for opts in \ |
| 61 | '-G' |
| 62 | do |
| 63 | test_perf "git log $icase$opts'$pattern'$from_rev_desc" " |
| 64 | git log --pretty=format:%H $icase$opts'$pattern'$from_rev |
| 65 | " |
| 66 | done |
| 67 | done |
| 68 | done |
| 69 | |
| 70 | test_done |