Ruby 初心者スレッド Part 21
at TECH
780:730
08/09/09 16:40:58
>>776
どういうメソッドが使われたかはプロファイラを使えばわかるみたいですね。
$ ruby -r profile -e 'test = (0..100000).to_a' % cumulative self self total
time seconds seconds calls ms/call ms/call name
100.00 0.08 0.08 1 80.00 80.00 Range#each
0.00 0.08 0.00 1 0.00 80.00 Enumerable.to_a
0.00 0.08 0.00 1 0.00 80.00 #toplevel
$ ruby -r profile -e 'test = Array.new(100000){|i| i}' % cumulative self self total
time seconds seconds calls ms/call ms/call name
100.00 1.15 1.15 1 1150.00 1150.00 Array#initialize
0.00 1.15 0.00 1 0.00 1150.00 Class#new
0.00 1.15 0.00 1 0.00 1150.00 #toplevel
次ページ続きを表示1を表示最新レス表示スレッドの検索類似スレ一覧話題のニュースおまかせリスト▼オプションを表示暇つぶし2ch
5493日前に更新/211 KB
担当:undef