I'm wishing to figure out how many milliseconds a particular function uses. So I looked high and low, but could not find a way to get the time in Ruby with millisecond precision.
How do you do this? In most programming languages its just something like
start = now.milliseconds
myfunction()
end = now.milliseconds
time = end - start
Best Answer
You can use ruby's
Time
class. For example:Now,
delta
is afloat
object and you can get as fine grain a result as the class will provide.