scittle

chromalchemy 2024-09-17T22:29:36.990769Z

Is there a performance penalty for using threading macros in scittle? (re when to use transducers, etc for performance optimization) https://clojurians.slack.com/archives/C03S1L9DN/p1726612065946789?thread_ts=1726598503.958429&cid=C03S1L9DN

borkdude 2024-09-17T22:33:15.831859Z

The performance penalty is only paid once, so if you have a function that uses the threading macro, you only pay a little bit of time when the function's code is analyzed, but not when it's executed

chromalchemy 2024-09-17T22:37:12.346539Z

Ok, so that performance penalty would not scale by the amount of functions in a given thread. Just the fact of a threading macro in a fn, means one “penalty” for that function, at analysis (interpretation) time. Is that right?

borkdude 2024-09-17T22:49:11.624309Z

well, actually the analysis phase is done once, but interpretation is done many times on the result of the analysis

borkdude 2024-09-17T22:49:35.928819Z

just think of analysis as compilation and interpretation as a way to run the output of the "compilation"

chromalchemy 2024-09-17T23:28:11.818139Z

Ok thanks. So during analysis (“compilation”) the threading macros are substituted, and there is no further penalty per use. At that point, it is like I wrote the code without threading? Per the cljs thread; It sounds like I probably should not fret over using threading macros, unless there is a blatant performance issue.. And even then I would probably be more focused on other aspects (lazyness), not the inclusion of threading macro itself.

👍 1