I'm currently going through the Project Euler's problems and I'm solving them both in C# and Scheme (the Racket implementation). I know C# but I'm learning Scheme as I go along.
Now, on top of having the correct results for the problems, I like to come up with the fastest possible solution I can think of. To that effect, in C# I use StopWatch to measure the performance of my code. Is there a similar Scheme library / functionality to time code execution?
Just enclose the whole part you want to time in the time
expression (this works in most implementations, including Racket):
(time (rest-of-program))
You can also use the Unix command time
if you're on Linux/OSX/BSD/etc., e.g.
time ./my_program
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With