This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2024-07-01
Channels
- # announcements (4)
- # babashka (19)
- # beginners (19)
- # calva (24)
- # cider (1)
- # clerk (7)
- # clj-otel (60)
- # clojars (22)
- # clojure (15)
- # clojure-europe (20)
- # clojure-nl (2)
- # clojure-norway (61)
- # clojure-uk (9)
- # clojurescript (18)
- # community-development (3)
- # cursive (3)
- # datahike (4)
- # datalevin (5)
- # emacs (8)
- # off-topic (23)
- # polylith (46)
- # releases (6)
- # spacemacs (8)
- # yamlscript (1)
Hi. Is there a way to compile using Google Closure Advanced Optimizations, but turning off property and variable renaming?
shadow-cljs has options for this, but IIRC turning that all of disables a couple :advanced
optimizations as well
I'm interested in comparing gzipped sizes of renamed vs unrenamed modules with advanced optimizations on, the hypothesis being that gzip could already be doing a good job in shortening names.
I've seen the VARIABLE_RENAMING
and PROPERTY_RENAMING
params in the Closure Compiler source code, but I'm not sure how to make use of those, especially through ClojureScript.
> :pseudo-names true
makes it easier to relate advanced output to what CLJS generated
Maybe this could help making an assessment, thanks.
@U050B88UR
shadow-cljs has options for thisYou mean the :compiler-options
, or others? I haven't found those in the Shadow-cljs manual.
Thanks! I'll try those out
if you want this for debugging use shadow-cljs release app --pseudo-names
. pseudo names still renames everything, but makes names somewhat recognizable. as david suggested, as a debugging aid that is useful.

for example closure will turn most function signatures into similar structures, so all function become function(a,b,c)
or similar. that gzips much much better than just function(foo, bar, whatever)
where the names vary from function to function
I see, that's smart
there is some really smart stuff in the naming strategies used, pretty much often picked with gzip in mind
there were some really old blog posts about what they did and why, but I can't find them anymore
Yeah it seems that variable renaming is the most significant part. The gain from property renaming in the case I have at hand is small (difference of 0,5 MB; 30 kB gzipped).
IIRC property naming could vary greatly between builds, but it has been many years so can't quite remember details
@titogarcia :pseudo-names true
makes it easier to relate advanced output to what CLJS generated