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

None

Activity

Show:
Mike Fikes
May 12, 2019, 2:31 AM

CLJS-2885.patch added to Patch Tender

Mike Fikes
October 6, 2018, 10:38 PM

Passes in CI and Canary.

Mike Fikes
September 4, 2018, 5:32 PM

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.)

Assignee

David Nolen

Reporter

Mike Fikes

Labels

None

Approval

None

Patch

Code

Priority

Minor