[#28501] rb_gc_call_finalizer_at_exit() の実行中かどうかを知りたい — Hidetoshi NAGAI <nagai@...>
永井@知能.九工大です.
6 messages
2006/04/03
[#28502] Re: rb_gc_call_finalizer_at_exit() の実行中かどうかを知りたい
— Yukihiro Matsumoto <matz@...>
2006/04/03
まつもと ゆきひろです
[#28509] Rational — Tadayoshi Funaba <tadf@...>
ふなばです。
49 messages
2006/04/05
[#28510] Re: Rational
— keiju@... (石塚圭樹)
2006/04/05
けいじゅ@いしつかです.
[#28512] Re: Rational
— Tadayoshi Funaba <tadf@...>
2006/04/05
ふなばです。
[#28515] Re: Rational
— keiju@... (石塚圭樹)
2006/04/05
けいじゅ@いしつかです.
[#28522] Re: Rational
— Tadayoshi Funaba <tadf@...>
2006/04/06
ふなばです。
[#28523] Re: Rational
— Yukihiro Matsumoto <matz@...>
2006/04/06
まつもと ゆきひろです
[#28526] Re: Rational
— Tadayoshi Funaba <tadf@...>
2006/04/06
ふなばです。
[#28530] Re: Rational
— Tadayoshi Funaba <tadf@...>
2006/04/09
ふなばです。
[#28513] Re: Rational
— Shin-ichiro HARA <sinara@...>
2006/04/05
原です。
[#28514] Re: Rational
— keiju@... (石塚圭樹)
2006/04/05
けいじゅ@いしつかです.
[#28517] Re: Rational
— Yukihiro Matsumoto <matz@...>
2006/04/06
まつもと ゆきひろです
[#28520] Re: Rational
— keiju@... (石塚圭樹)
2006/04/06
けいじゅ@いしつかです.
[#28521] Re: Rational
— Yukihiro Matsumoto <matz@...>
2006/04/06
まつもと ゆきひろです
[#28525] Re: Rational
— keiju@... (石塚圭樹)
2006/04/06
けいじゅ@いしつかです.
[#28527] Re: Rational
— Shin-ichiro HARA <sinara@...>
2006/04/06
原です。
[#28536] Re: Rational
— Shin-ichiro HARA <sinara@...>
2006/04/10
原です。
[#28537] Re: Rational
— keiju@... (石塚圭樹)
2006/04/10
けいじゅ@いしつかです.
[#28545] Re: Rational
— Shin-ichiro HARA <sinara@...>
2006/04/11
原です。
[#28546] Re: Rational
— Yukihiro Matsumoto <matz@...>
2006/04/11
まつもと ゆきひろです
[#28547] Re: Rational
— keiju@... (石塚圭樹)
2006/04/11
けいじゅ@いしつかです.
[#28548] Re: Rational
— Yukihiro Matsumoto <matz@...>
2006/04/11
まつもと ゆきひろです
[#28550] Re: Rational
— keiju@... (石塚圭樹)
2006/04/12
けいじゅ@いしつかです.
[#28563] Proxy authentication patches for open-uri and rubygems — "Tadashi Kadowaki" <tadakado@...>
門脇と申します。
3 messages
2006/04/15
[#28569] rational 1.01 — Shin-ichiro HARA <sinara@...>
原です。
16 messages
2006/04/16
[#28571] Re: rational 1.01
— Tadayoshi Funaba <tadf@...>
2006/04/16
ふなばです。
[#28572] Re: rational 1.01
— Shin-ichiro HARA <sinara@...>
2006/04/16
原です。
[#28573] Re: rational 1.01
— Tadayoshi Funaba <tadf@...>
2006/04/16
ふなばです。
[#28574] Re: rational 1.01
— Shin-ichiro HARA <sinara@...>
2006/04/16
原です。
[#28575] Re: rational 1.01
— Shin-ichiro HARA <sinara@...>
2006/04/17
原です。
[#28576] Re: rational 1.01
— Tadayoshi Funaba <tadf@...>
2006/04/17
ふなばです。
[#28578] Re: rational 1.01
— Tadayoshi Funaba <tadf@...>
2006/04/17
ふなばです。
[#28584] Re: rational 1.01
— Shin-ichiro HARA <sinara@...>
2006/04/18
原です。
[#28589] Float#div and Float#divmod [AGAIN] — Shin-ichiro HARA <sinara@...>
原です。
16 messages
2006/04/23
[#28590] Re: Float#div and Float#divmod [AGAIN]
— Yukihiro Matsumoto <matz@...>
2006/04/23
まつもと ゆきひろです
[#28609] Re: Float#div and Float#divmod [AGAIN]
— Shin-ichiro HARA <sinara@...>
2006/04/30
原です。
[#28591] Re: Float#div and Float#divmod [AGAIN]
— Shin-ichiro HARA <sinara@...>
2006/04/23
[#28592] Re: Float#div and Float#divmod [AGAIN]
— Yukihiro Matsumoto <matz@...>
2006/04/23
まつもと ゆきひろです
[ruby-dev:28561] Re: 鬼車パフォーマンス
From:
"K.Kosako" <sndgk393@...>
Date:
2006-04-13 14:11:13 UTC
List:
ruby-dev #28561
Yukihiro Matsumoto wrote:
> [ruby-talk:188721]で、以下のプログラム(特にquxと呼ばれるパター
> ンにおいて)1.9(鬼車)が1.8より遅いという指摘がありました。
>
> お知らせまで。
お知らせありがとうございます。
LinuxとCygwinで確認してみました。
(但し、GCの影響を除くためにGC.disableを追加して、
繰り返し回数を三十万回に変更しました。)
結果は以下のようになりました。
若しこの程度の差であれば、想定の範囲内です。
quxが遅いのは検索ではなく、毎回Regexp.newしている
部分が原因です。これは、鬼車のほうが最適化情報の
取得に時間をかけているので、正規表現の作成時間が
長くなるためです。
"qux new empty"と"qux new"の時間の比較から
大雑把に言って、Regexpオブジェクトの生成全体の
約15%はruby自身の処理時間で、残りが鬼車の処理時間
だと思います。なので、この程度の短いパターンの
ときには、問題ないレベルだと思います。
でも長いパターンのときが気になるので、時間を減らせる
部分があるかどうか、一応検討はしてみます。
ruby 1.8.4 (2006-03-01) [i686-linux]
user system total real
foo 1.090000 0.100000 1.190000 ( 1.203012)
bar 0.980000 0.040000 1.020000 ( 1.023069)
qux new empty 1.570000 0.340000 1.910000 ( 1.943319)
qux new 2.920000 1.870000 4.790000 ( 14.304892)
qux search 0.470000 0.020000 0.490000 ( 1.712328)
qux 3.150000 0.420000 3.570000 ( 21.151487)
ruby 1.9.0 (2006-03-01) [i686-linux]
user system total real
foo 0.980000 0.110000 1.090000 ( 1.101956)
bar 0.890000 0.040000 0.930000 ( 0.944269)
qux new empty 1.330000 0.340000 1.670000 ( 1.684494)
qux new 6.240000 0.050000 6.290000 ( 6.378824)
qux search 0.460000 0.000000 0.460000 ( 0.463881)
qux 6.830000 0.010000 6.840000 ( 6.937301)
ruby 1.8.4 (2005-12-24) [i386-cygwin]
user system total real
foo 1.051000 0.010000 1.061000 ( 1.061000)
bar 0.981000 0.000000 0.981000 ( 0.991000)
qux new empty 2.053000 0.030000 2.083000 ( 2.083000)
qux new 3.285000 0.280000 3.565000 ( 11.176000)
qux search 0.341000 0.000000 0.341000 ( 0.360000)
qux 3.595000 0.260000 3.855000 ( 14.581000)
ruby 1.9.0 (2006-04-08) [i386-cygwin]
user system total real
foo 1.041000 0.000000 1.041000 ( 1.061000)
bar 0.961000 0.000000 0.961000 ( 0.961000)
qux new empty 1.242000 0.030000 1.272000 ( 1.272000)
qux new 4.997000 0.020000 5.017000 ( 5.017000)
qux search 0.350000 0.000000 0.350000 ( 0.360000)
qux 5.238000 0.000000 5.238000 ( 5.278000)
--
小迫
@re = /^\w+-\w+$/ # Some random expression
def foo(str)
str =~ @re
end
def bar(str)
str =~ /^\w+-\w+$/
end
def qux(str)
str =~ Regexp.new("/^\w+-\w+$/")
end
def qux_new(str)
Regexp.new("/^\w+-\w+$/")
end
def qux_new_empty(str)
Regexp.new("")
end
def qux_search(str)
str =~ /\/^\w+-\w+$\//
end
require 'benchmark'
include Benchmark
N = 300_000
bm(16) do |test|
GC.disable
test.report("foo") do
N.times {foo("abc-xyz")}
end
GC.enable
GC.start
GC.disable
test.report("bar") do
N.times {bar("abc-xyz")}
end
GC.enable
GC.start
GC.disable
test.report("qux new empty") do
N.times {qux_new_empty("abc-xyz")}
end
GC.enable
GC.start
GC.disable
test.report("qux new") do
N.times {qux_new("abc-xyz")}
end
GC.enable
GC.start
GC.disable
test.report("qux search") do
N.times {qux_search("abc-xyz")}
end
GC.enable
GC.start
GC.disable
test.report("qux") do
N.times {qux("abc-xyz")}
end
end