[過去ログ] Ruby 初心者スレッド Part 66 (1002レス)
前次1-
抽出解除 レス栞

このスレッドは過去ログ倉庫に格納されています。
次スレ検索 歴削→次スレ 栞削→次スレ 過去ログメニュー
535
(1): (ワッチョイ 275f-8Kp1) 2020/05/23(土)20:20 ID:x0bVPHOi0(2/3) AAS
>>534
# gem install benchmark_driver
require 'benchmark_driver'

Benchmark.driver do |x|
x.prelude %{ input = (1..2_000_000).to_a.shuffle
RUBY
x.report 'push without size', %{o = []; input.each{|x| o.push x }}
省4
537
(1): (ワッチョイ 5a01-S/TN) 2020/05/23(土)21:52 ID:KnmbZWpz0(3/3) AAS
>>535
そのwith sizeとwithout sizeはpushの差では?

require 'benchmark_driver'

Benchmark.driver do |x|
x.prelude %{ input = (1..2_000_000).to_a.shuffle }
x.report 'Array.new(0)', %{o = Array.new(0); input.each{|x| o.push(x+1)}}
x.report 'Array.new(input.size)', %{o = Array.new(input.size); input.each{|x| o.push(x+1)}}
省7
前次1-
スレ情報 赤レス抽出 画像レス抽出 歴の未読スレ AAサムネイル

ぬこの手 ぬこTOP 0.026s