Skip to content
This repository

Benchmarking bm_loop_whileloop.rb failed on i386 with Error::EDOM #2219

Open
ryoqun opened this Issue · 1 comment

2 participants

Ryo Onodera Dirkjan Bussink
Ryo Onodera
Collaborator

Here is the error backtrace:

$ ./bin/benchmark ./benchmark/tiers/0/bm_loop_whileloop.rb
=== bin/rbx ===
          while loop
Error in ./benchmark/tiers/0/bm_loop_whileloop.rb:
An exception occurred
    Numerical argument out of domain - sqrt (Errno::EDOM)

Backtrace:
                         Math.sqrt at kernel/common/math.rb:136
          Benchmark::Timing.stddev at benchmark/lib/benchmark/timing.rb:38
              { } in Benchmark.ips at benchmark/lib/benchmark/ips.rb:214
                        Array#each at kernel/bootstrap/array.rb:68
                     Benchmark.ips at benchmark/lib/benchmark/ips.rb:153
                 Object#__script__ at benchmark/tiers/0/bm_loop_whileloop.rb:4
     Kernel(Benchmark::Suite)#load at kernel/common/kernel.rb:586
              Benchmark::Suite#run at benchmark/lib/benchmark/suite.rb:81
          { } in Object#__script__ at benchmark/lib/benchmark/suite-run.rb:26
                        Array#each at kernel/bootstrap/array.rb:68
          { } in Object#__script__ at benchmark/lib/benchmark/suite-run.rb:19
           Benchmark::Suite.create at benchmark/lib/benchmark/suite.rb:16
                 Object#__script__ at benchmark/lib/benchmark/suite-run.rb:16
  Rubinius::CodeLoader#load_script at kernel/delta/codeloader.rb:68
  Rubinius::CodeLoader.load_script at kernel/delta/codeloader.rb:118
           Rubinius::Loader#script at kernel/loader.rb:615
             Rubinius::Loader#main at kernel/loader.rb:816
Dirkjan Bussink
Owner

This is actually a pretty funny issue. This happens because the code is actually too fast :). The before and after here are apparently rounded to the same value:

https://github.com/rubinius/rubinius/blob/master/benchmark/lib/benchmark/ips.rb#L204

This means the time is 0, which results in an infinite number of instructions / second here:

https://github.com/rubinius/rubinius/blob/master/benchmark/lib/benchmark/ips.rb#L211

That ends up resulting in the EDOM error, since we can't compute further with these values when computing the mean and stddev.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.