repo.or.cz
/
jruby.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
history
|
raw
|
HEAD
Fix for JRUBY-2882. Handle error messages related to constructors better
[jruby.git]
/
bench
/
bench_fib_iterative.rb
blob
ab9e333f7a7ad64cae69ed4cf387ddf06c8be08e
1
require 'benchmark'
2
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
15
16
puts Benchmark.measure { fib_iter_ruby(300000) }
17
puts Benchmark.measure { fib_iter_ruby(300000) }