I've implemented my own merge sort in MIT Scheme. I want to test it against the builtin merge-sort
and compare times; however, I don't know how to get the run time of both. Also how do you increase the stack size/recursion depth as i'm testing up to 1 million elements.
There's a bunch of timing procedures in MIT Scheme, check the documentation. In particular, try this one:
(with-timings
(lambda ()
(merge-sort '(1 2 3 4 5) >))
(lambda (run-time gc-time real-time)
(write (internal-time/ticks->seconds run-time))
(write-char #\space)
(write (internal-time/ticks->seconds gc-time))
(write-char #\space)
(write (internal-time/ticks->seconds real-time))
(newline)))
The built-in sort
shouldn't have a problem with one million elements, if your own implementation is a good one, it shouldn't have problems producing a result with that data size.