On Mar 20, 10:18=A0am, Jason Lillywhite <jason.lillywh... / gmail.com>
wrote:
> Is there an easy way to display the time it takes to compute any
> function from within IRB?
> --
> Posted viahttp://www.ruby-forum.com/.

It's not unheard of for people to add something like this to their
irbrc:

  def time
    start =3D Time.now
    result =3D yield
    puts "Completed in #{Time.now - start} seconds."
    result
  end

In use:

  016:0> time { ('a'*10_000_000).sub(/a+/,'hi') }
  Completed in 0.446504 seconds.
  "hi"

HTH,
Chris