Criterium measures the computation time of an expression. It is designed to address some of the pitfalls of benchmarking, and benchmarking on the JVM in particular.
This includes:
Usage: (use 'criterium.core) (bench (Thread/sleep 1000) :verbose) (with-progress-reporting (bench (Thread/sleep 1000) :verbose)) (report-result (benchmark (Thread/sleep 1000)) :verbose) (report-result (quick-bench (Thread/sleep 1000)))
References: See http://www.ellipticgroup.com/html/benchmarkingArticle.html for a Java benchmarking library. The accompanying article describes many of the JVM benchmarking pitfalls.
See http://hackage.haskell.org/package/criterion for a Haskell benchmarking library that applies many of the same statistical techniques.
Criterium measures the computation time of an expression. It is designed to address some of the pitfalls of benchmarking, and benchmarking on the JVM in particular. This includes: - statistical processing of multiple evaluations - inclusion of a warm-up period, designed to allow the JIT compiler to optimise its code - purging of gc before testing, to isolate timings from GC state prior to testing - a final forced GC after testing to estimate impact of cleanup on the timing results Usage: (use 'criterium.core) (bench (Thread/sleep 1000) :verbose) (with-progress-reporting (bench (Thread/sleep 1000) :verbose)) (report-result (benchmark (Thread/sleep 1000)) :verbose) (report-result (quick-bench (Thread/sleep 1000))) References: See http://www.ellipticgroup.com/html/benchmarkingArticle.html for a Java benchmarking library. The accompanying article describes many of the JVM benchmarking pitfalls. See http://hackage.haskell.org/package/criterion for a Haskell benchmarking library that applies many of the same statistical techniques.
Fraction of excution time allowed for final cleanup before a warning is issued.
Fraction of excution time allowed for final cleanup before a warning is issued.
Maximum number of attempts to run finalisers and gc.
Maximum number of attempts to run finalisers and gc.
Flag to control output of debug messages
Flag to control output of debug messages
Flag to control output of progress messages
Flag to control output of progress messages
Flag to control output of warning messages
Flag to control output of warning messages
Target elapsed time for execution for a single measurement.
Target elapsed time for execution for a single measurement.
Time period used to let the code run so that jit compiler can do its work.
Time period used to let the code run so that jit compiler can do its work.
(bench expr & opts)Convenience macro for benchmarking an expression, expr. Results are reported to out in human readable format. Options for report format are: :os, :runtime, and :verbose.
Convenience macro for benchmarking an expression, expr. Results are reported to *out* in human readable format. Options for report format are: :os, :runtime, and :verbose.
(benchmark expr options)Benchmark an expression. This tries its best to eliminate sources of error. This also means that it runs for a while. It will typically take 70s for a fast test expression (less than 1s run time) or 10s plus 60 run times for longer running expressions.
Benchmark an expression. This tries its best to eliminate sources of error. This also means that it runs for a while. It will typically take 70s for a fast test expression (less than 1s run time) or 10s plus 60 run times for longer running expressions.
(benchmark* measured {:keys [supress-jvm-option-warnings] :as options})Benchmark a function. This tries its best to eliminate sources of error. This also means that it runs for a while. It will typically take 70s for a fast test expression (less than 1s run time) or 10s plus 60 run times for longer running expressions.
Benchmark a function. This tries its best to eliminate sources of error. This also means that it runs for a while. It will typically take 70s for a fast test expression (less than 1s run time) or 10s plus 60 run times for longer running expressions.
(extract-report-options opts)Extract reporting options from the given options vector. Returns a two element vector containing the reporting options followed by the non-reporting options
Extract reporting options from the given options vector. Returns a two element vector containing the reporting options followed by the non-reporting options
(options->time-config {:keys [max-gc-attempts warmup-jit-period] :as options})(quick-bench expr & opts)Convenience macro for benchmarking an expression, expr. Results are reported to out in human readable format. Options for report format are: :os, :runtime, and :verbose.
Convenience macro for benchmarking an expression, expr. Results are reported to *out* in human readable format. Options for report format are: :os, :runtime, and :verbose.
(quick-benchmark expr options)Benchmark an expression. Less rigorous benchmark (higher uncertainty).
Benchmark an expression. Less rigorous benchmark (higher uncertainty).
(quick-benchmark* f {:as options})Benchmark an expression. Less rigorous benchmark (higher uncertainty).
Benchmark an expression. Less rigorous benchmark (higher uncertainty).
(warn-on-suspicious-jvm-options)Warn if the JIT options are suspicious looking.
Warn if the JIT options are suspicious looking.
(with-progress-reporting expr)Macro to enable progress reporting during the benchmark.
Macro to enable progress reporting during the benchmark.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |