zepto-lang / bench

A minimal benchmarking library for zepto

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

bench

A minimal benchmarker for statements in zepto.

Usage

Bench exposes two endpoints, time and bench. They are used like this:

(bench:time '(+ 1 2))  ; will return time elapsed in nanoseconds
(bench:bench '(+ 1 2))
; will test the statement 100k times and print metrics in the format:
; Tested function 100000 times:
; 	Average duration:   13952.31 	( 1.395231e-5 secs) 
; 	Best case:          0 	( 0.0 secs) 
; 	Worst case:         308000 	( 3.08e-4 secs) 
; 	Total:              1395231000 	( 1.395231 secs)
(bench:bench '(+ 1 2) 100) ; will test the statement 100 times
```

Functions as arguments are supported too.

<br/>

*Have fun!*

About

A minimal benchmarking library for zepto

License:GNU General Public License v2.0