# HG changeset patch # User Masataka Kohagura # Date 1455097179 -32400 # Node ID cfaafa20942491f9bfbb715f9980a91048291b20 # Parent 724c29abb13794d6f5126e10671fef643863f4e3 add diff -r 724c29abb137 -r cfaafa209424 c4.tex --- a/c4.tex Wed Feb 10 17:34:17 2016 +0900 +++ b/c4.tex Wed Feb 10 18:39:39 2016 +0900 @@ -560,11 +560,18 @@ \label{fig:cctreemerge} \end{figure} +\newpage +\subsection{DFA を元にパターンマッチを行う} +NFA、DFA の生成後、読み込んだファイルに対してパターンマッチを行う。今回の例題では、 + +\begin{itemize} +\item DFA を生成後(NFA であれば、Subset Construction後)、逐次に状態と遷移先を照らし合わせる。 +\item DFA をkh +\end{itemize} + on the fly subset construction で使わない状態は生成しないで済む -\newpage -\subsection{DFA を元にパターンマッチを行う} \subsection{(Word をノードに含める話)} diff -r 724c29abb137 -r cfaafa209424 memo/result.txt --- a/memo/result.txt Wed Feb 10 17:34:17 2016 +0900 +++ b/memo/result.txt Wed Feb 10 18:39:39 2016 +0900 @@ -1,5 +1,31 @@ Wed Feb 10 11:06:12 JST 2016 +egrep -o '(a|b)*a(a|b)(a|b)' file/ab500MB.txt > /dev/null +82.88s user 0.20s system 99% cpu 1:23.09 total +egrep 83.09 + +./cerium/ceriumGrep -regex '(a|b)*a(a|b)(a|b)' -file file/ab500MB.txt -cpu 8 32.82s user 0.85s system 202% cpu 16.595 total +[キャッシュ有] +cpu time + 1 29.053 + 2 24.032 + 4 21.091 + 8 16.595 + +[キャッシュ無 mmap] +cpu time + 1 57.654 + 2 48.683 + 4 43.959 + 8 33.365 + +[キャッシュ無 bread] +cpu time + 1 40.494 + 2 36.912 + 4 33.718 + 8 34.257 + ./cerium/ceriumGrep -regex '[A-Z][a-zA-Z0-9_]*' -file file/500MB.txt > 25.29s user 0.53s system 100% cpu 25.721 total [キャッシュ有] @@ -33,12 +59,16 @@ 7 15.388 8 15.901 +-- DFA を生成後、配列にアクセスして状態遷移-- + [キャッシュ無] ./regexParser -subset -regex '[A-Z][a-zA-Z0-9_]*' -ts -file file/500MB.txt > 16.06s user 0.22s system 77% cpu 21.139 total [キャッシュ有] ./regexParser -subset -regex '[A-Z][a-zA-Z0-9_]*' -ts -file file/500MB.txt > 16.05s user 0.19s system 99% cpu 16.246 total +-- cgrep , egrep -- + cgrep -G '[A-Z][a-zA-Z0-9_]*' file/500MB.txt --no-line-umber --no-filename >/dev/null 測れない(2時間ぐらいぶんまわしてた)