I want to see how long a function takes to run. What's the easiest way to do this in PLT-Scheme? Ideally I'd want to be able to do something like this:
> (define (loopy times)
(if (zero? times)
0
(loopy (sub1 times))))
> (loopy 5000000)
0 ;(after about a second)
> (timed (loopy 5000000))
Took: 0.93 seconds
0
>
It doesn't matter if I'd have to use some other syntax like (timed loopy 5000000)
or (timed '(loopy 5000000))
, or if it returns the time taken in a cons or something.