Find out the time used for searching a file

Hi all,

When I run a script to search some files in a folder and/or its children
folders I want know how long it takes when the search is done. Is there
any such method available in Ruby ?

Thanks,

Li

Li Chen wrote:

When I run a script to search some files in a folder and/or its children
folders I want know how long it takes when the search is done. Is there
any such method available in Ruby ?

a) Research the Benchmark library
b)
start_time = Time.new

do stuff here

end_time = Time.new
puts( “It took #{end_time - start_time} seconds” )

require ‘benchmark’

seconds = Benchmark.realtime do
#do stuff here
end

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs