Created
March 31, 2010 18:32
-
-
Save nz/350693 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def sequence4(n, m, c, b) | |
# p("Inside sequence4") | |
i = 0 | |
while(i < n) | |
b.call i*m + c | |
i += 1 | |
end | |
end | |
proc1 = Proc.new { |x| puts x } | |
sequence4(6,3,3,proc1) | |
require 'benchmark' | |
n = 100 | |
Benchmark.bm do |x| | |
x.report { n.times { sequence4(6,3,3,proc1) }} | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Simplified from https://gist.github.com/350693/e8a61cb1b7c65fd5438c323da23bab4ff2a810a9
Replaced Time.now.usec with ruby benchmark module.