Skip to content

Bare REPL

Justin Conklin edited this page Nov 11, 2017 · 4 revisions

When using this library without a tool such as Leiningen that manages Clojure's *compile-path*, you will need to manually make sure that it exists and is on the classpath.

For example, we'll run benchmarks in a bare REPL started via clojure.jar:

$ CLASSPATH=...  # clojure.jar, jmh-clojure and dependencies

$ mkdir -p classes  # Clojure's default for *compile-path*

$ java -cp "$CLASSPATH":classes clojure.main -r

Now in your REPL, you can run jmh-clojure like normal:

(require '[jmh.core :as jmh])

(jmh/run-fn #(Thread/sleep 100))
;; => {:score [9.936689 "ops/s"], #_...}

When you're done, you will likely want to remove the generated class and resource files.

$ rm -rf classes/jmh* classes/META-INF/{BenchmarkList,CompilerHints}
Clone this wiki locally