[Ruby 1.9-Bug#4341][Open] baserubyに1.8.xを指定すると make benchmark がエラー

Bug #4341: baserubyに1.8.xを指定すると make benchmark がエラー
http://redmine.ruby-lang.org/issues/show/4341

起票者: Motohiro KOSAKI
ステータス: Open, 優先度: Normal
Target version: 1.9.x
ruby -v: ruby 1.9.3dev (2011-01-28 trunk 30708) [x86_64-linux]

trunkをビルドするとき、baserubyを指定する必要があるのですが、多くの人はruby-1.8.xを
指定していると思います(それが推奨と以前聞きました)。

しかしながら、make benchmarkがbaseruby指定時にbaserubyとビルドしたrubyとの性能比較モードで
動作するため以下のエラーが出ます。


benchmark results:
name ruby 1.8.6 (2010-02-05) [x86_64-linux] ruby 1.9.3dev
(2011-01-29 trunk 30718) [x86_64-linux]
app_answer 1.176 0.227
app_erb 1.881 0.972
./benchmark/driver.rb:208:in measure': Benchmark process exited with abnormal status (256) (RuntimeError) from ./benchmark/driver.rb:192:in measure_file’
from ./benchmark/driver.rb:20:in map' from ./benchmark/driver.rb:188:in each’
from ./benchmark/driver.rb:188:in map' from ./benchmark/driver.rb:188:in measure_file’
from ./benchmark/driver.rb:187:in map' from ./benchmark/driver.rb:187:in measure_file’
from ./benchmark/driver.rb:162:in run' from ./benchmark/driver.rb:20:in each_with_index’
from ./benchmark/driver.rb:160:in each' from ./benchmark/driver.rb:160:in each_with_index’
from ./benchmark/driver.rb:160:in run' from ./benchmark/driver.rb:26:in benchmark’
from ./benchmark/driver.rb:249
make: *** [benchmark] Error 1

「Benchmark process exited」と言われてもまったく分からんのですが、
エスパー能力により以下のスクリプトが stack level too deep で異常終了
するのが原因と分かりました。

benchmark/bm_app_factorial.rb

def fact(n)
if(n > 1)
n * fact(n-1)
else
1
end
end

8.times{
fact(5000)
}

  1. benchmarkディレクトリに1.8.xで動作するスクリプトしか置かない
  2. make benchmark のデフォルト動作を変え、baserubyは無視する

の二案あるのですが (2) が現実的だと思います。

チケット #4341 が更新されました。 (by Yui NARUSE)

ステータス OpenからClosedに変更
進捗 % 0から100に変更

This issue was solved with changeset r30747.
Motohiro, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.


  • lib/benchmark.rb: fix benchmarck to work with current ruby.
    patched by Benoit D. [ruby-core:33846] [ruby-dev:43143]
    merged from Commits · eregon/ruby · GitHub

  • lib/benchmark (Report#width): update documentation

  • lib/benchmark: document the return value of #benchmark and the
    :list attribute in Report

  • lib/benchmark (Tms#format): rename variables, use String#%
    instead of Kernel.format

  • lib/benchmark: remove undocumented Benchmark::times (an alias
    of Process::times used twice)

  • lib/benchmark (#benchmark): use label_width for the caption

  • lib/benchmark (Tms#initialize): rename variables

  • lib/benchmark: allow title to not be a String and call #to_s

  • lib/benchmark (Benchmark#bm): return an Array of the times with
    the labels

  • lib/benchmark: correct output for Benchmark#bmbm
    (remove the extra space)

  • lib/benchmark: add a few tests for Benchmark::Tms output

  • lib/benchmark: improve style (enumerators, ljust, unused vars)

  • lib/benchmark: add spec about output and return value

  • lib/benchmark: improve basic style and consistency
    no parenthesis for print and use interpolation instead of printf

  • lib/benchmark: remove unnecessary conversions and variables

  • lib/benchmark: correct indentation

  • lib/benchmark: rename the FMTSTR constant and variable to FORMAT

  • lib/benchmark: remove useless exception

  • test/benchmark: remove unused variable warnings