Fork me on GitHub
#gratitude
<
2022-07-28
>
dpsutton02:07:42

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
gratitude 3
๐Ÿ‘ 1
dpsutton02:07:23

(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 speedup

adi08:07:09

Criterium rocks metal

steveb8n03:07:01

Iโ€™m grateful to the person that created this channel. What other tech communities have something like this?

gratitude 7
๐Ÿ‘ 4
๐Ÿ’œ 4
steveb8n03:07:24

Or is this another way in which the Clojure community is uniquely high quality?

Cora (she/her)13:07:48

awww, thanks. I was inspired to create it by the one we have at work ๐Ÿ’œ

๐Ÿ’œ 7