Skip to content
Leiningen plugin for jmh-clojure
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
dev-resources/leiningen
dev
resources
sample-project
src/leiningen
test
.gitignore
.travis.yml
CHANGELOG.md
LICENSE
README.md
project.clj

README.md

Clojars Project Travis CI

Adding to your project

Add [lein-jmh "0.2.6"] to your :plugins section. For example:

(defproject your-project "0.1.0-SNAPSHOT"
  #_...
  :plugins [[lein-jmh "0.2.6"]])

What is it?

Leiningen plugin for running jmh-clojure benchmarks.

Usage

By default, a jmh.edn file at the root of your project is used to configure lein-jmh. Please see the sample file for documentation. For example, the following will run all benchmarks:

$ lein jmh

The task takes a single argument that gives the task and/or benchmark options. Please see the jmh-clojure docs or lein help jmh for more information. For example, to run all benchmarks that match a selector from a data file in an alternate location:

$ lein jmh '{:file "benchmarks/parser.edn", :select :decode}'

Available options

In addition to the normal run options, extra task options include:

Option Description
:exclude keys to remove from each benchmark result map.
:file read the given file(s) instead of jmh.edn.
:format print results in the given format.
:only keys to select from each benchmark result map.
:output specify the location to write the results.
:pprint equivalent to :format :pprint.
:progress display progress data while running.
:sort key(s) to order the results by.

Please see lein help jmh for more information on the available options. Note that some formats (e.g., :table) exclude some result information due to space considerations. See the previously mentioned help for details.

The available JMH profilers may be listed with: lein jmh :profilers.

Tiered compilation

The JVM option -XX:TieredStopAtLevel=1 is normally set automatically by Leiningen when running code in your project. This option speeds up JVM startup time but is normally problematic for benchmarking as it disables the C2 compiler.

Since lein-jmh merges the :jmh profile automatically when running benchmarks, adding the following to your project's :profiles key should be sufficient for most users:

:profiles {:jmh {:jvm-opts []}}

Alternatively, use :fork and specify different :jvm :args to override the Leiningen parent process arguments. This can be specified in your jmh.edn file, or globally via the task options map.

More information

This plugin is a wrapper for the jmh-clojure library. Please see the documentation there for more.

Running the tests

lein test

Or, lein test-all for all supported Clojure versions.

License

Copyright © 2019 Justin Conklin

Distributed under the Eclipse Public License, the same as Clojure.

You can’t perform that action at this time.