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.
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.
Here, we will show you how to test the performance of your code using Criterium.