This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2024-01-02
Channels
- # announcements (7)
- # atom-editor (3)
- # babashka (8)
- # beginners (38)
- # biff (5)
- # calva (17)
- # cider (26)
- # clj-kondo (6)
- # clojure (49)
- # clojure-europe (47)
- # clojure-norway (19)
- # clojure-sweden (2)
- # clojure-uk (1)
- # clojurescript (22)
- # cursive (20)
- # datahike (1)
- # datomic (6)
- # etaoin (2)
- # honeysql (2)
- # hyperfiddle (36)
- # jobs-discuss (19)
- # leiningen (15)
- # malli (5)
- # off-topic (8)
- # overtone (1)
- # pathom (15)
- # pedestal (8)
- # polylith (4)
- # releases (1)
- # ring (5)
- # schema (10)
- # shadow-cljs (17)
- # timbre (3)
- # xtdb (17)
Is it possible to write a macro that uses a reader conditional? Or, expressed differently: write a macro that emits different code for clj and cljs.
write a macro that emits different code for clj and cljsYes, (if (:ns &env) (cljs-emitting-fn) (clj-emitting-fn))
.
I'm benchmarking and optimizing some code. I noticed a spike in runtime (5x) after I added a namespace to a single keyword (e.g. :kw
=> :mylib/kw
). Is this to be expected, or is this more likely a red herring? I have isolated this single change and can repeatedly produce this result. It's very surprising to me.
It would surprise me too. Have you tried profiling an optimized version of the same code and comparing the results between different keywords? Also, JS VMs can behave in surprising ways when you hit certain limits: https://clojurians.slack.com/archives/C03S1L9DN/p1698696253410799?thread_ts=1698600341.327839&cid=C03S1L9DN
Even stranger: only 1 out of 9 tests in the benchmark exhibit this behavior, and they all "touch" the keyword
Out of curiosity from that other thread I re-ran the benchmark with 1.10.597, but got the same results.
I was using what I thought was the latest ClojureScript: 1.11.60. In the other thread I see 1.11.121. Github and the clojurescript website have 1.11.60. Where can I find the most up to date version list?
This version has the same behavior. Also, my "good" version runs slower on 1.11.121 than 1.11.60 :thinking_face:
can you share this benchmark? I'd be rather curious to reproduce this. in theory there should be no real measurable difference with a namespaced keyword. as the only difference is the length of the string the browser has to compare (possibly once)
or maybe the benchmark hits a different branch due to the keyword not matching anymore? kinda hard to say without knowing what the benchmark does.
I can share it! It's not on Github right now, but will get it there and let you know
All the tests pass, so I think behavior is the same. But I agree - must probably be something like that.