Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (defmacro benchmark*
- [functions lst]
- (println ";" (str-join "" (repeat 72 \=)))
- (pprint `~lst)
- (letfn [(make-fragment [f] `(let [m# ~lst] (~f m#)))]
- `(do
- ~@(loop [functions functions timers []]
- (if (seq functions)
- (recur (rest functions)
- (cons `(do
- (print ";" (quote ~(first functions)) ": ")
- (time ~(make-fragment (first functions)))
- nil)
- timers))
- timers))
- (println))))
- (defmacro benchmark**
- [functions lst]
- (println ";" (str-join "" (repeat 72 \=)))
- (pprint `~lst)
- (letfn [(make-fragment [f] `(let [m# ~lst] (time (~f m#))))]
- `(do
- ~@(loop [functions functions timers []]
- (if (seq functions)
- (recur (rest functions)
- (cons `(do
- (print ";" (quote ~(first functions)) ": ")
- ~(make-fragment (first functions))
- nil)
- timers))
- timers))
- (println))))
Add Comment
Please, Sign In to add comment