reitit/perf-test/clj/reitit/perf_utils.clj
2017-08-30 08:16:21 +03:00

16 lines
470 B
Clojure

(ns reitit.perf-utils
(:require [criterium.core :as cc]))
(defn raw-title [color s]
(println (str color (apply str (repeat (count s) "#")) "\u001B[0m"))
(println (str color s "\u001B[0m"))
(println (str color (apply str (repeat (count s) "#")) "\u001B[0m")))
(def title (partial raw-title "\u001B[35m"))
(def suite (partial raw-title "\u001B[32m"))
(defmacro bench! [name & body]
`(do
(title ~name)
(println ~@body)
(cc/quick-bench ~@body)))