Welcome! Please see the About page for a little more info on how this works.

0 votes
in ClojureScript by

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.

4 Answers

0 votes
by
_Comment made by: mfikes_

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

{:a 2, :b [1 2 3], :c {:x 1, :y :kw}, :d [1 :ab {:x 1}], :e "string"}

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.)
0 votes
by

Comment made by: mfikes

Passes in CI and Canary.

0 votes
by

Comment made by: mfikes

CLJS-2885.patch added to Patch Tender (i)

0 votes
by
Reference: https://clojure.atlassian.net/browse/CLJS-2885 (reported by mfikes)
...