On Mon, Oct 15, 2012 at 10:14 PM, Herwig Hochleitner <hhochleit...@gmail.com
> wrote:

> When investigating what the closure compiler does with cljs output, I
> discovered the following:
>
> Google closure does not eliminate unused var reads. This means that e.g. a
> deftype
>
> (deftype A [])
>
> which compiles to
>
> workbench.foo.A = (function (){
>     .... snip ....
> });
> workbench.foo.A; // <-- because of this
>
> does not get stripped out of the compilate if A is never used even with
> advanced optimizations.
>
> What can we do about this? I tried changing clojurescript's deftype macro
> to not return the type itself.
> This shrank a clojurescript hello world from *about 100k to 75k*. Quite
> an improvement for a single line change.
>

Yep I think there are quite a few things like this. But I don't think we
need an optimization pass for this paticular case (and I'm not saying
that's not a good idea - see below). Hopefully we can a direct patch for
this issue around top level deftypes/records.

Is there interest in including hooks for optimizations in CLJS? If so, is
> the approach outlined above reasonably straightforward or do we need a
> confluence page?
>
> kind regards
>

Definitely needs a Confluence page. I know several people are interested in
this. I think it would be pretty sweet to provide common optimizations out
of the box.

David

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to