Benchmarking with Criterium, performance tips, and other tools
In this recipe, we will learn how to test, measure, and improve the performance of your application. We will show you a Clojure-based benchmark tool.
Getting ready
To use Criterium, we need to add the criterium
library in your project.clj
as follows:
(defproject performance-example "0.1.0-SNAPSHOT" :description "FIXME: write description" :url "http://example.com/FIXME" :license {:name "Eclipse Public License" :url "http://www.eclipse.org/legal/epl-v10.html"} :dependencies [[org.clojure/clojure "1.8.0"] [criterium "0.4.4"]])
Then, restart your REPL.
How to do it...
Here, we will show you how to test the performance of your code using Criterium.
Using Criterium
Criterium is a micro benchmark ...
Get Clojure Programming Cookbook now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.