This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-07-28
Channels
- # asami (1)
- # aws (9)
- # babashka (16)
- # beginners (32)
- # calva (2)
- # clj-kondo (20)
- # cljdoc (6)
- # clojure (35)
- # clojure-dev (25)
- # clojure-europe (11)
- # clojure-india (1)
- # clojure-norway (2)
- # clojure-spec (26)
- # clojure-uk (1)
- # clojurescript (41)
- # conjure (3)
- # css (9)
- # cursive (18)
- # data-oriented-programming (6)
- # data-science (2)
- # emacs (47)
- # events (1)
- # fulcro (15)
- # graalvm (30)
- # gratitude (7)
- # honeysql (27)
- # inf-clojure (4)
- # introduce-yourself (2)
- # lsp (129)
- # malli (7)
- # missionary (21)
- # nbb (17)
- # off-topic (18)
- # re-frame (6)
- # releases (1)
- # shadow-cljs (120)
- # vim (7)
- # xtdb (15)
Very thankful for criterium
. Really helped out today. Found out multi-release jars make logging very slow with log4j2. Apparently Logger.getLogger()
(or whatever exact syntax) got really slow with modules (like 20x-114x slower) and clojute.tools.logging gets the logger on every call. Reifying a custom LoggerFactory
that memoizes the loggers got us back down to to ~1.5x of a non multi-release jar
๐ 6
3
๐ 1
(def ^org.slf4j.Logger factory (org.slf4j.LoggerFactory/getILoggerFactory))
(criterium.core/bench (.getLogger factory "ROOT"))
these two forms.
In a jar that is not marked multi-release:
Execution time mean : 485.311104 ns
In a multi-release jar:
Execution time mean : 5.808895 ยตs
Which is 5808 ns, so ~10x slower. And each call to c.t.l/log hits this, even for logging calls below the enabled threshold. So memoizing the LoggerFactory
โs get-logger
function can really save time. Free speedupIโm grateful to the person that created this channel. What other tech communities have something like this?
7
๐ 4
๐ 4
awww, thanks. I was inspired to create it by the one we have at work ๐
๐ 7