clojure.core/time¶
Evaluates expr and prints the time it took. Returns the value of expr.
Examples¶
Note by mars0i¶
Because the Java JIT compiler compiles code differently after the code has been running for a bit of time, if you want to use time for benchmarking, you should at least "warm up" your code by running it several times, using the later time outputs as the ones that count. A better strategy is to use a benchmarking library such as Criterium, which will do the warmup for you, and much more.
Content from the matching ClojureDocs page, with authors credited on each contribution.