Let’s say that you want to profile a piece of code in clojurescript. There is a cool macro for that in clojurescript: time .
time evaluates an expression and prints the time it took and returns the value of the expression.
The interesting question is:
time print the time it took?
Usually, it prints in the browser console. This is because, you have probably called
(enable-console-print!) somewhere in your code.
But as aKLIPSE user, you want the time to be displayed in the evaluation rectangle instead of inside the console.
It’s simple to achieve that using with-out-str .
Let’s see it in action by comparing the running time of two naive implementations for prime number generation: