Re: [closure-compiler-discuss] Object property names optimization

25 views
Skip to first unread message

John Lenz

unread,
Apr 12, 2013, 10:29:57 AM4/12/13
to closure-compiler

Sure, you need to enable "alias externals" via the java api or a custom build but you don't want to. It will be much larger post zip.

On Apr 12, 2013 5:54 AM, <dsi...@gmail.com> wrote:
Is there a way to make the compiler (in SIMPLE_OPTIMIZATIONS mode) translate "obj.somePropertyName=value;" to "var ab='somePropertyName';obj[ab]=value;"? This will reduce the code size if "obj.somePropertyName" is used multiple times. 

simil

--
 
---
You received this message because you are subscribed to the Google Groups "Closure Compiler Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to closure-compiler-d...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Ilia Mirkin

unread,
Apr 13, 2013, 4:20:47 PM4/13/13
to closure-comp...@googlegroups.com
It's just the way it is...

$ echo 'var a="asdf";a;a;a;a;' | gzip -c | wc
0 1 36
$ echo '"asdf";"asdf";"asdf";"asdf";' | gzip -c | wc
0 1 31

The intuition is that the way deflate algorithms like gzip work is by
finding similarities. You're trying to do that by hand, which will
interfere with the gzip algorithm.

On Sat, Apr 13, 2013 at 4:17 AM, <dsi...@gmail.com> wrote:
> Can you please explain why it will be a larger zip?
>
> Thanks,
> simil
Reply all
Reply to author
Forward
0 new messages