るりまサーチ (Ruby 3.1)

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

別のキーワード

  1. process abort
  2. process fork
  3. process setrlimit
  4. tracer display_process_id
  5. tracer display_process_id?

種類

ライブラリ

モジュール

検索結果

Benchmark.#measure(label = "") { ... } -> Benchmark::Tms (54370.0)

与えられたブロックを実行して、経過した時間を Process.#times で計り、 Benchmark::Tms オブジェクトを生成して返します。

与えられたブロックを実行して、経過した時間を Process.#times で計り、
Benchmark::Tms オブジェクトを生成して返します。

Benchmark::Tms オブジェクトには to_s が定義されているので、
基本的には以下のように使います。

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

puts Benchmark::CAPTION
puts Benchmark.measure { "a"*1_000_000 }

#=>
#
# user system total real
# 1.1666...

NEWS for Ruby 3.1.0 (91.0)

NEWS for Ruby 3.1.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。

...NEWS for Ruby 3.1.0
このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。

それぞれのエントリーは参照情報があるため短いです。
十分な情報と共に書かれた全ての変更のリス...
...{
foo[0] = bar
//}

* 次の評価順序になります。

//emlist{
1. `foo`
2. `bar`
3. `[]=` called on the result of `foo`
//}

* Ruby 3.1.0より前は、多重代入の評価順序が上記のようではありませんでした。このコードでは、

//emlist[][ruby]{
foo[0], b...
...//emlist{
1. `a`
2. `b`
3. `foo`
4. `[]=` called on the result of `foo`
5. `bar`
6. `baz=` called on the result of `bar`
//}

* Ruby 3.1.0から単一代入と評価順序が一致するようになり、左が右より先に評価されます。

//emlist{
1. `foo`
2. `bar`
3....