Fork me on GitHub
#rum
<
2022-08-16
>
alex14:08:57

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?