DCE-friendly cljs.pprint
Description
If you simply require cljs.pprint in your code, then you end up with an extra 30 KB of JavaScript after Closure processing and typical gzip compression.
This ticket seeks to see if there is anything we can do to make this namespace more DCE-friendly.
Environment
Activity
CLJS-2885.patch added to Patch Tender
Passes in CI and Canary.
The attached patch essentially eliminates all code in the case that cljs.pprint is required but never used. (Some small amount of code remains owing to the need to preserve some public defmulti s.) But, as soon as something like pprint or cl-format is used, most of the code is brought back in as non-dead.
In terms of runtime performance, at the REPL, pprint ing
is about 10% faster, perhaps owing to the use of case constructs over defmulti. The same is about 20% faster under :advanced. (Perhaps the revisions are amenable to Closure optimization.)