Skip to content

dakrone/cbench

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 

Repository files navigation

cbench is a small helper library for doing benchmarking.

Here's some sample output:

cbench=> (cbench-pp 50 #(Thread/sleep 15))
-----------------------------------
| avg    | 15.22 ms
| min    | 15.0 ms
| max    | 19.0 ms
| stddev | 0.614119729717384 ms
| total  | 784 ms
-----------------------------------
nil

cbench provides 2 function, cbench and cbench-pp.

First, you'll need to be leinigen - http://github.com/technomancy/leiningen ,
when leinigen is installed, use "lein jar" to build the cbench jar.

Place the cbench.jar file somewhere in your java classpath. From the Clojure
REPL you should be able to access the cbench and cbench-pp functions:

user=> (use 'cbench)
nil
user=> (cbench 50 #(Thread/sleep 10))
[10.06 11.0 10.0 0.3392674720850722 509]
user=> (cbench-pp 50 #(Thread/sleep 10))
-----------------------------------
| avg    | 10.1 ms
| min    | 10.0 ms
| max    | 11.0 ms
| stddev | 0.4285717918757761 ms
| total  | 509 ms
-----------------------------------
nil

As you can see, cbench-pp is just pretty formatting for cbench.

cbench and cbench-pp both take a number of iterations (50 in the example)
and a no-argument function, which is benchmarked the number of times given.

Use it to test how much reflection helps, or whether there's a lot of
variance between your function call times.

About

A small clojure benchmarking helper

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published