Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add example of output to readme

  • Loading branch information...
commit 1063575663d5bca89ba900ce0a115dbcc22d9a9d 1 parent 99b468d
@hugoduncan authored
Showing with 22 additions and 9 deletions.
  1. +22 −9 README.md
View
31 README.md
@@ -22,27 +22,40 @@ The top level interface is in `criterium.core`.
Use `bench` to run a benchmark in a simple manner.
- (bench (Thread/sleep 1000) :verbose)
+```
+(bench (Thread/sleep 1000))
+ =>
+ Execution time mean : 1.000803 sec
+ Execution time std-deviation : 328.501853 us
+ Execution time lower quantile : 1.000068 sec ( 2.5%)
+ Execution time upper quantile : 1.001186 sec (97.5%)
+```
By default bench is quiet about its progress. Run `with-progress-reporting` to
-get progress information on *out*.
+get progress information on `*out*`.
- (with-progress-reporting (bench (Thread/sleep 1000) :verbose))
- (with-progress-reporting (quick-bench (Thread/sleep 1000) :verbose))
+```clj
+(with-progress-reporting (bench (Thread/sleep 1000) :verbose))
+(with-progress-reporting (quick-bench (Thread/sleep 1000) :verbose))
+```
Lower level functions are available, that separate benchmark statistic
generation and reporting.
- (report-result (benchmark (Thread/sleep 1000)) :verbose)
- (report-result (quick-benchmark (Thread/sleep 1000)))
+```clj
+(report-result (benchmark (Thread/sleep 1000)) :verbose)
+(report-result (quick-benchmark (Thread/sleep 1000)))
+```
Note that results are returned to the user to prevent JIT from recognising that
the results are not used. For functions that are very fast, or return a lot of
data, you may need to supply a function to reduce the results to prevent
-excessive memory allocation.
-
- (bench (rand) :reduce-with +)
+excessive memory allocation. The default for :reduce-with adds the hash codes of
+the results.
+```clj
+(bench (rand) :reduce-with +)
+```
## References
Please sign in to comment.
Something went wrong with that request. Please try again.