Last active
October 28, 2016 08:46
-
-
Save wordijp/2df65e7d5bb39826c122c01fde050bff to your computer and use it in GitHub Desktop.
Linuxカーネルソースのgrep、ripgrp(rg)、git grepベンチ用シェルスクリプト
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| echo_and_do () { | |
| echo $ "$1" | |
| eval "$1" | |
| } | |
| echo =============================================== | |
| echo grep, ripgrep, git grep benchmark\(by cygwin environment\) | |
| echo =============================================== | |
| echo "*** 注意点 ***********************************************************************************" | |
| echo Windows上で動作させているため、git grepと差異があります。 | |
| echo \(予約名\(aux.c, aux.h\)、大文字小文字違い\(xt_rateest.c, xt_RATEEST.c, etc\)がcheckout出来ない\) | |
| echo "**********************************************************************************************" | |
| #echo_and_do "git status" | |
| ncpu_plus1=`expr $(cat /proc/cpuinfo | grep processor | wc -l) + 1` | |
| echo ncpu + 1: $ncpu_plus1 | |
| echo -n warm-up start | |
| grep -lr EXPORT_SYMBOL_GPL . --exclude-dir=.git > /dev/null | |
| echo -n . | |
| rg -l EXPORT_SYMBOL_GPL . > /dev/null | |
| echo -n . | |
| git grep -l EXPORT_SYMBOL_GOL > /dev/null | |
| echo -n . | |
| find . \( -type d -name .git -prune -wholename .git \) -o -type f > /dev/null | |
| echo done | |
| echo_and_do "grep --version | head -n 1" | |
| echo_and_do "rg --version" | |
| echo_and_do "git --version" | |
| echo ----- | |
| echo_and_do "time grep -lr EXPORT_SYMBOL_GPL . --exclude-dir=.git | wc -l" | |
| echo_and_do "time rg -l EXPORT_SYMBOL_GPL . | wc -l" | |
| echo_and_do "time rg -l EXPORT_SYMBOL_GPL . -j `expr $ncpu_plus1` | wc -l" | |
| echo_and_do "time git grep -l EXPORT_SYMBOL_GPL | wc -l" | |
| echo ----- | |
| echo_and_do "time find . \( -type d -name .git -prune -wholename .git \) -o -type f | wc -l" | |
| echo ----- | |
| echo_and_do "time find . \( -type d -name .git -prune -wholename .git \) -o -type f | xargs grep -l EXPORT_SYMBOL_GPL | wc -l" | |
| echo ----- | |
| echo "*** mistake(slowly) ***" | |
| echo_and_do "time find . \( -type d -name .git -prune -wholename .git \) -o -type f | xargs rg -l EXPORT_SYMBOL_GPL | wc -l" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment