I discovered this by accident:
Since quote?
is invoked for each cell and the set used as a predicate
#{separator quote \return \newline}
isn't a constant expression at compile time, for each cell clojure.lang.RT.set
will end up getting invoked.
For boring input data such as
(def xs (vec (for [_ (range 1000)]
(mapv identity (range 10)))))
it ends up consuming about 50% CPU
Can easily be avoided by binding the set to a local before closing over it inside write-csv
Would be nice if the compiler could detect this.
Thanks
Ben