Issue #6173 has been reported by Glass_saga (Masaki Matsushita). ---------------------------------------- Feature #6173: re.cのrb_memsearch()におけるmemchr()の利用 https://bugs.ruby-lang.org/issues/6173 Author: Glass_saga (Masaki Matsushita) Status: Open Priority: Normal Assignee: Category: core Target version: 2.0.0 re.cのrb_memsearch()では、m == 1な場合にはfor文で各バイトと比較していますが、memchr()を用いると性能の改善がみられます。 次のようなベンチマークを実行したところ、以下のような結果となりました。 require 'benchmark' str = "hoge" * 10000 + "\n" Benchmark.bm do |x| x.report do str.index("\n") end end trunk(r35083): user system total real 0.000000 0.000000 0.000000 ( 0.000185) proposal: user system total real 0.000000 0.000000 0.000000 ( 0.000018) patchを添付します。
on 2012-03-18 15:15
on 2012-03-18 16:11
Issue #6173 has been updated by Glass_saga (Masaki Matsushita). File patch2.diff added 特に添字を使う意味もなかったのでpatchを修正しました。 ---------------------------------------- Feature #6173: re.cのrb_memsearch()におけるmemchr()の利用 https://bugs.ruby-lang.org/issues/6173#change-24921 Author: Glass_saga (Masaki Matsushita) Status: Open Priority: Normal Assignee: Category: core Target version: 2.0.0 re.cのrb_memsearch()では、m == 1な場合にはfor文で各バイトと比較していますが、memchr()を用いると性能の改善がみられます。 次のようなベンチマークを実行したところ、以下のような結果となりました。 require 'benchmark' str = "hoge" * 10000 + "\n" Benchmark.bm do |x| x.report do str.index("\n") end end trunk(r35083): user system total real 0.000000 0.000000 0.000000 ( 0.000185) proposal: user system total real 0.000000 0.000000 0.000000 ( 0.000018) patchを添付します。
on 2012-03-19 01:27
Issue #6173 has been updated by Glass_saga (Masaki Matsushita).
optflags='-O0 -g'を付けてビルドしたtrunkを使っていたので、ベンチマークでproposalが不当に有利でした。
optflagsを外してビルドした上でベンチマークを取り直したところ、以下の結果となりました。
trunk(r35087):
user system total real
0.000000 0.000000 0.000000 ( 0.000049)
proposal:
user system total real
0.000000 0.000000 0.000000 ( 0.000019)
----------------------------------------
Feature #6173: re.cのrb_memsearch()におけるmemchr()の利用
https://bugs.ruby-lang.org/issues/6173#change-24929
Author: Glass_saga (Masaki Matsushita)
Status: Open
Priority: Normal
Assignee:
Category: core
Target version: 2.0.0
re.cのrb_memsearch()では、m ==
1な場合にはfor文で各バイトと比較していますが、memchr()を用いると性能の改善がみられます。
次のようなベンチマークを実行したところ、以下のような結果となりました。
require 'benchmark'
str = "hoge" * 10000 + "\n"
Benchmark.bm do |x|
x.report do
str.index("\n")
end
end
trunk(r35083):
user system total real
0.000000 0.000000 0.000000 ( 0.000185)
proposal:
user system total real
0.000000 0.000000 0.000000 ( 0.000018)
patchを添付します。
on 2012-03-29 19:25
Issue #6173 has been updated by mame (Yusuke Endoh). Status changed from Open to Assigned Assignee set to matz (Yukihiro Matsumoto) パッチは、まあいいんじゃないでしょうかね。 Glass_saga さんが登録したチケットで accept されそうなのが何個か 見当たるっぽいので、コミット権あげると楽な気がしますが、どんなもんでしょう。 ChangeLog には 8 回くらい名前が載ってるみたいです。 という意味で matz にアサイン。 -- Yusuke Endoh <mame@tsg.ne.jp> ---------------------------------------- Feature #6173: re.cのrb_memsearch()におけるmemchr()の利用 https://bugs.ruby-lang.org/issues/6173#change-25406 Author: Glass_saga (Masaki Matsushita) Status: Assigned Priority: Normal Assignee: matz (Yukihiro Matsumoto) Category: core Target version: 2.0.0 re.cのrb_memsearch()では、m == 1な場合にはfor文で各バイトと比較していますが、memchr()を用いると性能の改善がみられます。 次のようなベンチマークを実行したところ、以下のような結果となりました。 require 'benchmark' str = "hoge" * 10000 + "\n" Benchmark.bm do |x| x.report do str.index("\n") end end trunk(r35083): user system total real 0.000000 0.000000 0.000000 ( 0.000185) proposal: user system total real 0.000000 0.000000 0.000000 ( 0.000018) patchを添付します。
on 2012-10-26 23:54
Issue #6173 has been updated by ko1 (Koichi Sasada). パッチの判断は中田さん,お願い出来ますか&コミット頂けませんか. コミッタ権の判断は,まつもとさんでもいいんですが,多分反対は無さそうですが. ---------------------------------------- Feature #6173: re.cのrb_memsearch()におけるmemchr()の利用 https://bugs.ruby-lang.org/issues/6173#change-31681 Author: Glass_saga (Masaki Matsushita) Status: Assigned Priority: Normal Assignee: matz (Yukihiro Matsumoto) Category: core Target version: 2.0.0 re.cのrb_memsearch()では、m == 1な場合にはfor文で各バイトと比較していますが、memchr()を用いると性能の改善がみられます。 次のようなベンチマークを実行したところ、以下のような結果となりました。 require 'benchmark' str = "hoge" * 10000 + "\n" Benchmark.bm do |x| x.report do str.index("\n") end end trunk(r35083): user system total real 0.000000 0.000000 0.000000 ( 0.000185) proposal: user system total real 0.000000 0.000000 0.000000 ( 0.000018) patchを添付します。
on 2012-11-02 17:01
Issue #6173 has been updated by Glass_saga (Masaki Matsushita).
ベンチマークの負荷が小さすぎて非常に短い時間で終わってしまい、他の要因に左右されている可能性を否定できないと思ったので、
文字列の大きさと繰り返し回数を増やしてベンチマークを取り直しました。
require 'benchmark'
str = " " * 10_0000 + "\n"
Benchmark.bm do |x|
x.report do
10000.times do
str.index("\n")
end
end
end
trunk(r37428):
user system total real
0.940000 0.000000 0.940000 ( 0.933771)
proposal:
user system total real
0.090000 0.000000 0.090000 ( 0.093609)
十分なパフォーマンスの向上がみられたので、反対がなければ取り込んでコミットしようと思います。
----------------------------------------
Feature #6173: re.cのrb_memsearch()におけるmemchr()の利用
https://bugs.ruby-lang.org/issues/6173#change-32242
Author: Glass_saga (Masaki Matsushita)
Status: Assigned
Priority: Normal
Assignee: matz (Yukihiro Matsumoto)
Category: core
Target version: 2.0.0
re.cのrb_memsearch()では、m ==
1な場合にはfor文で各バイトと比較していますが、memchr()を用いると性能の改善がみられます。
次のようなベンチマークを実行したところ、以下のような結果となりました。
require 'benchmark'
str = "hoge" * 10000 + "\n"
Benchmark.bm do |x|
x.report do
str.index("\n")
end
end
trunk(r35083):
user system total real
0.000000 0.000000 0.000000 ( 0.000185)
proposal:
user system total real
0.000000 0.000000 0.000000 ( 0.000018)
patchを添付します。
Please log in before posting. Registration is free and takes only a minute.
Existing account
(Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
Log in with Google account | Log in with Yahoo account
No account? Register here.