This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-08-16
Channels
- # babashka (53)
- # beginners (61)
- # biff (2)
- # cherry (15)
- # cider (28)
- # clj-kondo (17)
- # clojure (57)
- # clojure-europe (27)
- # clojure-nl (13)
- # clojure-norway (6)
- # clojure-uk (4)
- # clojurescript (30)
- # core-async (2)
- # data-science (39)
- # datomic (16)
- # docker (34)
- # emacs (4)
- # events (1)
- # figwheel-main (9)
- # guix (5)
- # hiccdown (2)
- # honeysql (5)
- # hyperfiddle (5)
- # interceptors (1)
- # jobs (2)
- # joyride (5)
- # lsp (36)
- # midje (1)
- # minimallist (1)
- # nbb (21)
- # off-topic (45)
- # polylith (42)
- # rum (1)
- # shadow-cljs (24)
- # sql (1)
- # squint (62)
- # vrac (1)
- # xtdb (6)
Sablono (Daiquiri's predecessor) mentions the following https://github.com/r0man/sablono/wiki/Optimization-Tips#avoid-for
> Not really sablono specific but I think it fits here: for
macro generates a ton of code because it is very powerful. Often, though, you don't need the lazyness of for
and the flexibility and would be better off with a simple mapv
.
>
In contrast, Rum https://github.com/tonsky/rum/blob/gh-pages/README.md#performance`for` over map
to gain the benefit of pre-compiling Hiccup -> React calls
> Daiquiri, Rum's Hiccup compiler, pre-compiles certain Clojure forms that return Hiccup (for a list of these forms see compile-form
implementations) into React calls. When the compiler is not able to pre-compile a form it defers this operation to the runtime. Runtime interpretation is slower, the suggestion is to use Clojure forms that are handled by compile-form
, when it makes sense.
>
Probably the right answer is to measure both of these and see what makes sense given the context, but that involves some effort to profile every single map/for
usage.
Are folks here primarily using for
or map
? Does anyone have heuristics they can share for gaining a better intuition on this?