Skip to content

Instantly share code, notes, and snippets.

@nz
Created March 31, 2010 18:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nz/350693 to your computer and use it in GitHub Desktop.
Save nz/350693 to your computer and use it in GitHub Desktop.
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
@nz
Copy link
Author

nz commented Mar 31, 2010

Simplified from https://gist.github.com/350693/e8a61cb1b7c65fd5438c323da23bab4ff2a810a9

Replaced Time.now.usec with ruby benchmark module.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment