Writing large map into a file

Out of curiosity: why not just use spit and pr-str ?

pr-str will materialize a java.lang.String buffer containing the entire contents of the file eagerly. pr or prn however just streams writes to a writer, which lets you bypass the buffer and go “straight” to the disk. It’s just a memory/IO optimization that can be relevant for “lots” of data.

3 Likes