--
You received this message because you are subscribed to the Google Groups "Clojure Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to clojure-dev+unsubscribe@googlegroups.com.
To post to this group, send email to cloju...@googlegroups.com.
Visit this group at https://groups.google.com/group/clojure-dev.
For more options, visit https://groups.google.com/d/optout.
To unsubscribe from this group and stop receiving emails from it, send an email to clojure-dev...@googlegroups.com.
When you said "terribly inefficient" and "every function that calls a log fn will have the above readString call" were you referring to a compile/load-time cost or a runtime cost?
--
You received this message because you are subscribed to the Google Groups "Clojure Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to clojure-dev...@googlegroups.com.
Even then, it’s absolutely negligibleuser=> (quick-bench (read-string "#=(find-ns user)"))Evaluation count : 226824 in 6 samples of 37804 calls.Execution time mean : 2.019092 µsExecution time std-deviation : 99.951478 nsExecution time lower quantile : 1.899425 µs ( 2.5%)Execution time upper quantile : 2.120700 µs (97.5%)Overhead used : 2.399639 nsnil
On 29 May 2018, at 15:31, Thomas Heller <in...@zilence.net> wrote:
On Tue, May 29, 2018 at 4:06 PM Gary Fredericks <frederi...@gmail.com> wrote:When you said "terribly inefficient" and "every function that calls a log fn will have the above readString call" were you referring to a compile/load-time cost or a runtime cost?Sorry, should have been more clear. load-time cost only. load-time matters though ...A rough estimate in my code is that I have about 100 clojure.tools.logging usages. Assuming they are all in independent fns each is has its own .class generated. That is 100 times RT.readString during loading for my lib (shadow-cljs, experimenting with AOT). I have not benchmarked this but I'm willing to wager that this is at least one order of magnitude slower, probably more, than just calling Namespace.find.
It is a minor optimization, but since it affects load time it seems worth it.--
You received this message because you are subscribed to the Google Groups "Clojure Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to clojure-dev+unsubscribe@googlegroups.com.
To post to this group, send email to cloju...@googlegroups.com.
Visit this group at https://groups.google.com/group/clojure-dev.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Clojure Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to clojure-dev+unsubscribe@googlegroups.com.
(ns shadow.benchmark
(:import [clojure.lang RT Namespace]))
(time
(dotimes [i 10000]
(RT/readString "#=(find-ns shadow.benchmark)")))
(time
(dotimes [i 10000]
(Namespace/find 'shadow.benchmark)
))
"Elapsed time: 17.596967 msecs"
"Elapsed time: 0.306979 msecs"
I assume that quick-bench does a bunch of warmup for the JIT and other stuff you want in actual benchmarks. Load-time is different.