Fix for JRUBY-2882. Handle error messages related to constructors better
[jruby.git] / bench / bench_fib_iterative.rb
blobab9e333f7a7ad64cae69ed4cf387ddf06c8be08e
1 require 'benchmark'
3 def fib_iter_ruby(n)
4    i = 0
5    j = 1
6    cur = 1
7    while cur <= n
8      k = i
9      i = j
10      j = k + j
11      cur = cur + 1
12    end
13    i
14 end
16 puts Benchmark.measure { fib_iter_ruby(300000) }
17 puts Benchmark.measure { fib_iter_ruby(300000) }