2008-09-25
Rubyによる正規表現コンパイラ(その3)
ベンチマークしてみました。
if __FILE__ == $0 then require 'benchmark' ruby = "ruby" perl = "perl" dumy1 = "absadsafdsredddkflr" dumy2 = "sse3fdfds2#%666721" all = (dumy1 + dumy2 * 2 + dumy1) * 109000 + ruby + dumy1* 12 + dumy2 * 11 + perl + (dumy1 + dumy2 * 2 + dumy1) * 320 p all.size Benchmark.bm do |x| x.report { p (/ruby.*perl/ =~ all) p (/perl.*ruby/ =~ all) } llvmatch1 = MatcherLLVM.new st = reexp_comp(".*ruby.*perl") llvmatch1.compile(st) llvmatch2 = MatcherLLVM.new st = reexp_comp(".*perl.*ruby") llvmatch2.compile(st) x.report { p llvmatch1.match(all) p llvmatch2.match(all) } end end
結果です。
8090114
user system total real
8066000
nil
0.032000 0.000000 0.032000 ( 0.025000)
true
nil
0.156000 0.000000 0.156000 ( 0.164000)
llvmruby版の方が5倍ほど****遅い****です。
・・・、まあ世の中こんなものですね。
コメントを書く
トラックバック - http://d.hatena.ne.jp/miura1729/20080925/1222337556
リンク元
- 20 http://www.rubyist.net/~kazu/samidare/
- 2 http://d.hatena.ne.jp/akid/edit?date=20080925
- 2 http://d.hatena.ne.jp/keyword/ポインタ
- 2 http://d.hatena.ne.jp/tazant/20080822/1219407899
- 2 http://feeds.technorati.com/blogs/d.hatena.ne.jp/authorNari
- 2 http://www.google.com/search?num=50&hl=ja&lr=lang_ja&q=RFC1213
- 1 http://175.gmodules.com/ig/ifr?url=http://customrss.googlepages.com/customrss.xml&nocache=0&up_rssurl=http://k.hatena.ne.jp/keywordblog/Perl?mode=rss&up_title=「Perl」ブログ+&up_titleurl=http://d.hatena.ne.jp/keyword
- 1 http://b.hatena.ne.jp/entry/http://www.watch.impress.co.jp/game/docs/20080911/epic.htm
- 1 http://d.hatena.ne.jp/
- 1 http://d.hatena.ne.jp/diarylist?of=0&mode=rss&type=public