This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-09-04
Channels
- # announcements (5)
- # aws (12)
- # beginners (76)
- # boot (29)
- # cider (24)
- # circleci (9)
- # clojure (64)
- # clojure-dev (27)
- # clojure-europe (3)
- # clojure-houston (1)
- # clojure-italy (33)
- # clojure-nl (19)
- # clojure-poland (1)
- # clojure-spec (6)
- # clojure-uk (20)
- # clojurescript (103)
- # clojutre (1)
- # code-reviews (60)
- # cursive (76)
- # data-science (20)
- # datomic (20)
- # duct (58)
- # figwheel-main (4)
- # fulcro (36)
- # graphql (6)
- # kaocha (4)
- # onyx (1)
- # pathom (15)
- # quil (3)
- # re-frame (15)
- # reagent (15)
- # reitit (9)
- # remote-jobs (2)
- # rewrite-clj (16)
- # ring-swagger (7)
- # shadow-cljs (132)
- # spacemacs (12)
- # sql (5)
- # vim (9)
- # xtdb (12)
- # yada (4)
måning
mornign
Does anyone know of any small libraries suitable for performance testing / instrumenting small blocks of code with timing measurements? Obviously I know of criterium, which I use already — but I’m not interested in microbenchmarking, more just getting a feel for how long remote calls are taking… e.g. http requests, database queries, and perhaps occaisional blocks of code; where performance can be measured in seconds or minutes. I normally write a macro like this for the job:
(defmacro timeit [& forms]
`(let [start# (System/currentTimeMillis)]
~@forms
(let [end# (System/currentTimeMillis)
form-str# ~(if (>= (count forms) 2)
`(pr-str '(do ~@forms))
`(pr-str '~@forms))]
(println "Time taken for" form-str# "was" (- end# start#) "ms"))))
But wondering if there’s something similar in a library.Also I’ve seen http://github.com/ptaoussanis/tufte but it’s not really appealing to me…
I think it’d be nice to have something like the above, and perhaps a variant that will re define a var holding a function for you… but surely many people have packaged this up into a library.
there's a time
function in core iirc.
I'm expecting that as more people move to tools.deps/deps.edn (with the ability to pull arbitrary code from github), that micro/nano libraries will become more common.
yeah I use the time
macro a lot; but it has no means of identifying which output is from which call site.
@rickmoynihan sounds like a job for tap>
?
ahh yes good point
Though doesn’t that just mean replacing the println
above with a call to tap>
? I still need to write the macro — again! 🙂
that was quite wintlike @otfrom > the wise man bowed his head solemnly and spoke: "theres actually zero difference between println & other programs. "
You missed the rest of it @alex.lynham