Cljs *print-fn* / performance considerations

here is print-fn from cljs

(defonce
  ^{:doc "Each runtime environment provides a different way to print output.
  Whatever function *print-fn* is bound to will be passed any
  Strings which should be printed." :dynamic true}
  *print-fn* nil)

luminus leaves it on in dev and disables it for prod:

(set! *print-fn* (fn [& _]))

how does one reason about the performance implications of this?.. i mean… basically the intent should be to ignore println in prod, right?.. but ignoring large args like that can be pretty expensive… so i was wondering if something ( not too hackish :smile: ) could be done to ameliorate this situation.

any ideas?

1 Like

Don’t forget with-out-str! To “ignore println in prod” could break things. Nonetheless, it is interesting that the “pr” functions assemble the string before checking whether a *print-fn* exists to receive it. You could make your own debug-print function, of course.

1 Like

thx for taking the time to write back.

…now… i am not sure what you mean by:

… i mean… about using with-out-str it is not that i FORget it … i just DONTget how / why i should be using it… :smile: