るりまサーチ

最速Rubyリファレンスマニュアル検索!
66件ヒット [1-66件を表示] (0.142秒)

別のキーワード

  1. new openssl::bn
  2. new openssl::asn1::asn1data
  3. new openssl::pkey::ec::group
  4. new openssl::x509::certificate
  5. start net::smtp

ライブラリ

クラス

モジュール

キーワード

検索結果

Benchmark::Report#report(label = "", *fmt) { ... } -> Benchmark::Tms (18215.0)

ラベルと与えられたブロックの実行時間を標準出力に出力します。

...ラベルと与えられたブロックの実行時間を標準出力に出力します。

出力のフォーマットは Benchmark::Tms#format が行います。

@param label ラベル
@param fmt 結果に出力したいオブジェクト

@see Benchmark::Tms#format...

Benchmark::Report#list -> [Benchmark::Tms] (3139.0)

Benchmark::Report#item 実行時に作成された Benchmark::Tms オ ブジェクトの一覧を返します。

...Benchmark::Report#item 実行時に作成された Benchmark::Tms
ブジェクトの一覧を返します。

@see Benchmark::Report#item...

Benchmark::Report#item(label = "", *fmt) { ... } -> Benchmark::Tms (3115.0)

ラベルと与えられたブロックの実行時間を標準出力に出力します。

...ラベルと与えられたブロックの実行時間を標準出力に出力します。

出力のフォーマットは Benchmark::Tms#format が行います。

@param label ラベル
@param fmt 結果に出力したいオブジェクト

@see Benchmark::Tms#format...

Benchmark.#benchmark(caption = "", label_width = nil, fmtstr = nil, *labels) {|rep| ...} -> [Benchmark::Tms] (189.0)

Benchmark::Report オブジェクトを生成し、それを引数として与えられたブロックを実行します。

...Benchmark::Report オブジェクトを生成し、それを引数として与えられたブロックを実行します。

基本的には以下のように使います。
ブロックが Benchmark::Tms オブジェクトの配列を返した場合は、
それらの数値も追加の行に表示...
...ram labels ブロックが Benchmark::Tms オブジェクトの配列を返す場合に指定します。

=== フォーマット文字列

フォーマット文字列として以下が使用できます。

: %u
user CPU time で置き換えられます。Benchmark::Tms#utime
: %y
system CPU t...
..."s*y*stem")。Benchmark::Tms#stime
: %U
子プロセスの user CPU time で置き換えられます。Benchmark::Tms#cutime
: %Y
子プロセスの system CPU time で置き換えられます。Benchmark::Tms#cstime
: %t
total CPU time で置き換えられます。Benchmark::Tms#total
: %r...

Benchmark.#bm(label_width = 0, *labels) {|rep| ... } -> [Benchmark::Tms] (161.0)

Benchmark.#benchmark メソッドの引数を簡略化したものです。

...labels ブロックが Benchmark::Tms オブジェクトの配列を返す場合に指定します。

//emlist[][ruby]{
require 'benchmark'

n = 50000
Benchmark.bm do |x|
x.report { for i in 1..n; a = "1"; end }
x.report { n.times do ; a = "1"; end }
x.report { 1.upto(n) do ; a = "1";...
...書けます。

//emlist[][ruby]{
require 'benchmark'

n = 50000
Benchmark.bm(7) do |x|
x.report("for:") { for i in 1..n; a = "1"; end }
x.report("times:") { n.times do ; a = "1"; end }
x.report("upto:") { 1.upto(n) do ; a = "1"; end }
end

#=>
# user system total...
...uby]{
require 'benchmark'

n = 50000
Benchmark.bm(7, ">total:", ">avg:") do |x|
tf = x.report("for:") { for i in 1..n; a = "1"; end }
tt = x.report("times:") { n.times do ; a = "1"; end }
tu = x.report("upto:") { 1.upto(n) do ; a = "1"; end }
[tf + tt + tu, (tf + tt + tu) / 3]
end

#=>...

絞り込み条件を変える

Benchmark.#bmbm(width = 0) {|job| ... } -> [Benchmark::Tms] (113.0)

Benchmark::Job オブジェクトを生成して、それを引数として与えられたブロックを 実行します。

...幅を指定します。

//emlist[][ruby]{
require 'benchmark'

array = (1..1000000).map { rand }

Benchmark.bmbm do |x|
x.report("sort!") { array.dup.sort! }
x.report("sort") { array.dup.sort }
end

#=>
#
# Rehearsal -----------------------------------------
# sort! 11.928000 0.010000 11...