You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@shindig.apache.org by Paul Lindner <pl...@linkedin.com> on 2010/01/12 22:20:15 UTC

experiments with closure compiler

With a large number of cleanups to the jsdoc I was able to get the shindig
javascript compiled using the closure compiler.  Overall there's a 5%
reduction in gzip'd bytes (see table below)

Normally closure compiler is not used piecemeal like this.  instead it's
used on the entirety of a script.  Doing this for content from the concat
servlet shows a 6% reduction in gzip'd bytes:

   6671 Jan 12 12:34 rpc.cc.js.gz
   7116 Jan 12 12:34 rpc.opt.js.gz
  26427 Jan 12 12:32 if.cc.js.gz
  28171 Jan 12 12:30 if.opt.js.gz


To track the cleanups to the javascript I created
https://issues.apache.org/jira/browse/SHINDIG-1264  There's a bit more
remaining cleanup and some remaining outstanding warnings from my build.

REDUCTION IN GZIP BYTES

  orig    yui     cc diff fname
   595    104    103 1.0% target/classes/features/auth-refresh/auth-refresh
  2654    446    370 17.0% target/classes/features/core.auth/auth
   542     59     57 3.4% target/classes/features/core.auth/auth-init
  2883    590    545 7.6% target/classes/features/core.config/config
  5266   2647   2285 13.7% target/classes/features/core.io/io
   631    143    141 1.4% target/classes/features/core.io/taming
  2726    842    797 5.3% target/classes/features/core.json/json
   614    124    122 1.6% target/classes/features/core.json/taming
  3063   1347   1247 7.4% target/classes/features/core.legacy/legacy
  1220    303    288 5.0% target/classes/features/core.log/log
   671    189    186 1.6% target/classes/features/core.log/taming
  2575    777    725 6.7% target/classes/features/core.prefs/prefs
   676    186    184 1.1% target/classes/features/core.prefs/taming
   653    168    166 1.2% target/classes/features/core.util/taming
  3544    991    926 6.6% target/classes/features/core.util/util
   984    217    208 4.1%
target/classes/features/dynamic-height.util/dynamic-height-util
  2593    675    633 6.2%
target/classes/features/dynamic-height/dynamic-height
   630    144    141 2.1% target/classes/features/dynamic-height/taming
  2638   1116   1054 5.6% target/classes/features/flash/flash
  2092    995    929 6.6% target/classes/features/flash/taming
  1020    466    472 -1.3% target/classes/features/i18n/currencycodemap
  5240   1505   1451 3.6% target/classes/features/i18n/datetimeformat
  1915   1313   1356 -3.3% target/classes/features/i18n/datetimeformattest
  9641   2408   2276 5.5% target/classes/features/i18n/datetimeparse
  2821   1838   1879 -2.2% target/classes/features/i18n/datetimeparsetest
  2101    556    550 1.1% target/classes/features/i18n/formatting
  5618   2514   2399 4.6% target/classes/features/i18n/numberformat
  2251   1567   1586 -1.2% target/classes/features/i18n/numberformattest
  2609    999    933 6.6% target/classes/features/minimessage/minimessage
   660    175    172 1.7% target/classes/features/minimessage/taming
  2010    368    350 4.9% target/classes/features/oauthpopup/oauthpopup
  1695    727    723 0.6%
target/classes/features/opensocial-0.6/opensocial6to7
  1276    576    563 2.3%
target/classes/features/opensocial-0.7/opensocial7to8
   707    226    216 4.4%
target/classes/features/opensocial-0.8/opensocial8to9
  2184   1174   1099 6.4%
target/classes/features/opensocial-base/fieldtranslations
  1031    373    349 6.4%
target/classes/features/opensocial-base/jsonactivity
   731    191    186 2.6%
target/classes/features/opensocial-base/jsonmessage
   861    194    190 2.1%
target/classes/features/opensocial-base/jsonmessagecollection
  1186    580    548 5.5% target/classes/features/opensocial-base/jsonperson
  2310    660    601 8.9%
target/classes/features/opensocial-data-context/datacontext
  5767   2336   2216 5.1% target/classes/features/opensocial-data/data
  4116   2596   2505 3.5%
target/classes/features/opensocial-jsonrpc/jsonrpccontainer
  3629    375    374 0.3%
target/classes/features/opensocial-reference/activity
  1343    290    290 0.0%
target/classes/features/opensocial-reference/address
  1093    195    194 0.5%
target/classes/features/opensocial-reference/bodytype
  1263    257    251 2.3%
target/classes/features/opensocial-reference/collection
  3997    673    607 9.8%
target/classes/features/opensocial-reference/container
  4130    798    774 3.0%
target/classes/features/opensocial-reference/datarequest
  1173    174    169 2.9%
target/classes/features/opensocial-reference/dataresponse
  1029    159    158 0.6% target/classes/features/opensocial-reference/email
  1726    381    384 -0.8% target/classes/features/opensocial-reference/enum
  1294    359    350 2.5%
target/classes/features/opensocial-reference/environment
  1590    264    260 1.5%
target/classes/features/opensocial-reference/idspec
  1318    286    278 2.8%
target/classes/features/opensocial-reference/mediaitem
  1893    452    452 0.0%
target/classes/features/opensocial-reference/message
  1213    214    212 0.9%
target/classes/features/opensocial-reference/messagecollection
  1096    247    245 0.8% target/classes/features/opensocial-reference/name
  1564    246    245 0.4%
target/classes/features/opensocial-reference/navigationparameters
  3858    606    592 2.3%
target/classes/features/opensocial-reference/opensocial
  1427    264    263 0.4%
target/classes/features/opensocial-reference/organization
  3389   1141   1138 0.3%
target/classes/features/opensocial-reference/person
  1029    157    156 0.6% target/classes/features/opensocial-reference/phone
  1556    333    330 0.9%
target/classes/features/opensocial-reference/responseitem
  1448    851    870 -2.2%
target/classes/features/opensocial-reference/taming
  1066    174    174 0.0% target/classes/features/opensocial-reference/url
  4314   1595   1505 5.6% target/classes/features/opensocial-templates/base
  9647   3885   3672 5.5%
target/classes/features/opensocial-templates/compiler
  4375   1842   1714 6.9%
target/classes/features/opensocial-templates/container
  4153    978    905 7.5%
target/classes/features/opensocial-templates/jsTemplate/jsevalcontext
  9977   2767   2482 10.3%
target/classes/features/opensocial-templates/jsTemplate/jstemplate
  4231   1122   1060 5.5%
target/classes/features/opensocial-templates/jsTemplate/util
  2989   1246   1143 8.3%
target/classes/features/opensocial-templates/loader
  1301    308    297 3.6%
target/classes/features/opensocial-templates/namespaces
  2559    919    824 10.3% target/classes/features/opensocial-templates/os
  1644    645    620 3.9%
target/classes/features/opensocial-templates/template
  1441    386    360 6.7% target/classes/features/opensocial-templates/util
  1849    447    387 13.4% target/classes/features/osapi/batch
  1920    505    466 7.7% target/classes/features/osapi/gadgetsrpctransport
  1401    551    508 7.8% target/classes/features/osapi/jsonrpctransport
  1158    388    360 7.2% target/classes/features/osapi/osapi
   985    194    193 0.5% target/classes/features/osapi/peoplehelpers
   989    336    328 2.4% target/classes/features/osapi/taming
   981    227    210 7.5% target/classes/features/pubsub/pubsub
  1415    454    412 9.3% target/classes/features/pubsub/pubsub-router
   622    128    126 1.6% target/classes/features/pubsub/taming
  1785    474    445 6.1% target/classes/features/rpc/fe.transport
  2444    728    683 6.2% target/classes/features/rpc/ifpc.transport
  4045    887    840 5.3% target/classes/features/rpc/nix.transport
  6619   1420   1317 7.3% target/classes/features/rpc/rmr.transport
  9270   2292   2134 6.9% target/classes/features/rpc/rpc
  1610    454    429 5.5% target/classes/features/rpc/wpm.transport
  1181    359    328 8.6% target/classes/features/setprefs/setprefs
   723    121    120 0.8% target/classes/features/settitle/settitle
   606    116    114 1.7% target/classes/features/settitle/taming
  1226    253    242 4.3% target/classes/features/skins/skins
   608    117    115 1.7% target/classes/features/skins/taming
  5496   2640   2491 5.6% target/classes/features/tabs/tabs
   716    223    222 0.4% target/classes/features/tabs/taming
   705    215    212 1.4% target/classes/features/views/taming
  3653   1643   1550 5.7% target/classes/features/views/views
  1867    755    728 3.6% target/classes/features/xmlutil/xmlutil
---------------------------------------------------
238629  75921    728 5.1%
YUI Better   : 6 (131)
CC Better    : 92 (4017)

Re: experiments with closure compiler

Posted by Paul Lindner <li...@inuus.com>.
PHP is still using jsmin...

On Wed, Jan 20, 2010 at 7:49 AM, Tim Wintle <ti...@teamrubber.com>wrote:

> On Tue, 2010-01-12 at 17:19 -0800, ๏̯͡๏ Jasvir Nagra wrote:
> > YUI compressor compresses all valid input javascript correctly.  Closure
> > compiler under simple mode accepts a subset of javascript and produces
> > output that tries to be compatible with Caja's output semantics (
> > http://code.google.com/closure/compiler/faq.html#caja).  If we are
> willing
> > to author in a subset of javascript, we should instead aim for the Caja
> > subset (specifically the cajita subset).  The Caja Web Tools package (
> >
> http://code.google.com/p/google-caja/source/browse/#svn/trunk/src/com/google/caja/ancillary/opt
> )
> > provides comparable compression as well as a linter and jsdoc tool.  The
> > significant advantage over targetting closure compiler would be the
> ability
> > to inline gadgets on a page instead of iframing them.
>
> I hadn't come across the compiler in caja (I haven't really looked at
> caja) - but isn't a major benefit of the Closure compiler supposed to be
> optimised runtime?
>
> Just interested how that is/isn't included in the caja tools.
>
> Also, what's the state of the PHP javascript compression? IIRC the PHP
> version is/was stuck with jsmin (or off-line compression during
> deployment).
>
> Tim Wintle
>
>

Re: experiments with closure compiler

Posted by Tim Wintle <ti...@teamrubber.com>.
On Tue, 2010-01-12 at 17:19 -0800, ๏̯͡๏ Jasvir Nagra wrote:
> YUI compressor compresses all valid input javascript correctly.  Closure
> compiler under simple mode accepts a subset of javascript and produces
> output that tries to be compatible with Caja's output semantics (
> http://code.google.com/closure/compiler/faq.html#caja).  If we are willing
> to author in a subset of javascript, we should instead aim for the Caja
> subset (specifically the cajita subset).  The Caja Web Tools package (
> http://code.google.com/p/google-caja/source/browse/#svn/trunk/src/com/google/caja/ancillary/opt)
> provides comparable compression as well as a linter and jsdoc tool.  The
> significant advantage over targetting closure compiler would be the ability
> to inline gadgets on a page instead of iframing them.

I hadn't come across the compiler in caja (I haven't really looked at
caja) - but isn't a major benefit of the Closure compiler supposed to be
optimised runtime?

Just interested how that is/isn't included in the caja tools.

Also, what's the state of the PHP javascript compression? IIRC the PHP
version is/was stuck with jsmin (or off-line compression during
deployment).

Tim Wintle


Re: experiments with closure compiler

Posted by Paul Lindner <li...@inuus.com>.
This seems much more readable -- I'd like to see us adopt this pattern if
possible.

On Thu, Feb 4, 2010 at 2:05 PM, Kevin Brown <et...@google.com> wrote:

> On Thu, Feb 4, 2010 at 10:34 AM, Evan Gilbert <ui...@google.com> wrote:
>
> > On Wed, Jan 13, 2010 at 10:05 AM, Paul Lindner <li...@inuus.com>
> wrote:
> >
> > > I'm willing to use anything that helps reduce the size and improves the
> > > quality of the js.  For optimal usage the tool should allow for a maven
> > > plugin.
> > >
> > > In any case I think it might be interesting to generate externs.js
> files
> > > for
> > > each feature, and it might be interesting to concat the scripts for
> each
> > > feature together for more code size reduction.
> > >
> >
> > FYI - Closure Compiler has an @export annotation (couldn't find it
> > documented, but source is here:
> >
> >
> http://www.google.com/codesearch/p?hl=en#l5BkQmivP-Y/trunk/src/com/google/javascript/jscomp/FindExportableNodes.java&q=com.google.javascript%20package:%22http://closure-compiler.googlecode.com/svn%22&d=5
> > ).
> >
> > This may not work with the Shindig JS - not sure if the compiler is smart
> > enough to understand the anonymous function syntax that creates our
> > namespaces.
> >
>
> I don't think it does, but a fairly minor variation of what we're currently
> doing should work.
>
> Instead of:
>
> namespace.package = function() {
>  return {foo:foo, bar:bar};
> }
>
> just do the slightly more verbose:
>
> function() {
>  namespace.package = {};
>  namespace.package.foo = ...
> }();
>
> The resulting object is the same, and functions that aren't a part of the
> public interface will still be hidden in a closure.
>
> The downside is that the uncompiled code is larger.
>
>
> >
> > >
> > >
> > > 2010/1/12 ๏̯͡๏ Jasvir Nagra <ja...@google.com>
> > >
> > > > YUI compressor compresses all valid input javascript correctly.
> >  Closure
> > > > compiler under simple mode accepts a subset of javascript and
> produces
> > > > output that tries to be compatible with Caja's output semantics (
> > > > http://code.google.com/closure/compiler/faq.html#caja).  If we are
> > > willing
> > > > to author in a subset of javascript, we should instead aim for the
> Caja
> > > > subset (specifically the cajita subset).  The Caja Web Tools package
> (
> > > >
> > > >
> > >
> >
> http://code.google.com/p/google-caja/source/browse/#svn/trunk/src/com/google/caja/ancillary/opt
> > > > )
> > > > provides comparable compression as well as a linter and jsdoc tool.
> >  The
> > > > significant advantage over targetting closure compiler would be the
> > > ability
> > > > to inline gadgets on a page instead of iframing them.
> > > >
> > > > On Tue, Jan 12, 2010 at 1:37 PM, Paul Lindner <li...@inuus.com>
> > wrote:
> > > >
> > > > > There isn't a closure compiler maven plugin quite yet.  Also be
> aware
> > > > that
> > > > > the closure compiler is quite slow.  However using it has uncovered
> a
> > > > > number
> > > > > of issues.  See the warnings I just attached to the jira issue.
> > > > >
> > > > >
> > > > > On Tue, Jan 12, 2010 at 1:25 PM, John Hjelmstad <fa...@google.com>
> > > > wrote:
> > > > >
> > > > > > Looks good. Do you have a CL for pom.xml updates as well that
> > > switches
> > > > > from
> > > > > > YUI to CC?
> > > > > >
> > > > > > -j
> > > > > >
> > > > > > On Tue, Jan 12, 2010 at 1:20 PM, Paul Lindner <
> > plindner@linkedin.com
> > > >
> > > > > > wrote:
> > > > > >
> > > > > > > With a large number of cleanups to the jsdoc I was able to get
> > the
> > > > > > shindig
> > > > > > > javascript compiled using the closure compiler.  Overall
> there's
> > a
> > > 5%
> > > > > > > reduction in gzip'd bytes (see table below)
> > > > > > >
> > > > > > > Normally closure compiler is not used piecemeal like this.
> >  instead
> > > > > it's
> > > > > > > used on the entirety of a script.  Doing this for content from
> > the
> > > > > concat
> > > > > > > servlet shows a 6% reduction in gzip'd bytes:
> > > > > > >
> > > > > > >   6671 Jan 12 12:34 rpc.cc.js.gz
> > > > > > >   7116 Jan 12 12:34 rpc.opt.js.gz
> > > > > > >  26427 Jan 12 12:32 if.cc.js.gz
> > > > > > >  28171 Jan 12 12:30 if.opt.js.gz
> > > > > > >
> > > > > > >
> > > > > > > To track the cleanups to the javascript I created
> > > > > > > https://issues.apache.org/jira/browse/SHINDIG-1264  There's a
> > bit
> > > > more
> > > > > > > remaining cleanup and some remaining outstanding warnings from
> my
> > > > > build.
> > > > > > >
> > > > > > > REDUCTION IN GZIP BYTES
> > > > > > >
> > > > > > >  orig    yui     cc diff fname
> > > > > > >   595    104    103 1.0%
> > > > > > target/classes/features/auth-refresh/auth-refresh
> > > > > > >  2654    446    370 17.0%
> target/classes/features/core.auth/auth
> > > > > > >   542     59     57 3.4%
> > > target/classes/features/core.auth/auth-init
> > > > > > >  2883    590    545 7.6%
> > target/classes/features/core.config/config
> > > > > > >  5266   2647   2285 13.7% target/classes/features/core.io/io
> > > > > > >   631    143    141 1.4% target/classes/features/
> core.io/taming
> > > > > > >  2726    842    797 5.3% target/classes/features/core.json/json
> > > > > > >   614    124    122 1.6%
> target/classes/features/core.json/taming
> > > > > > >  3063   1347   1247 7.4%
> > target/classes/features/core.legacy/legacy
> > > > > > >  1220    303    288 5.0% target/classes/features/core.log/log
> > > > > > >   671    189    186 1.6%
> target/classes/features/core.log/taming
> > > > > > >  2575    777    725 6.7%
> target/classes/features/core.prefs/prefs
> > > > > > >   676    186    184 1.1%
> > target/classes/features/core.prefs/taming
> > > > > > >   653    168    166 1.2%
> target/classes/features/core.util/taming
> > > > > > >  3544    991    926 6.6% target/classes/features/core.util/util
> > > > > > >   984    217    208 4.1%
> > > > > > > target/classes/features/dynamic-height.util/dynamic-height-util
> > > > > > >  2593    675    633 6.2%
> > > > > > > target/classes/features/dynamic-height/dynamic-height
> > > > > > >   630    144    141 2.1%
> > > > target/classes/features/dynamic-height/taming
> > > > > > >  2638   1116   1054 5.6% target/classes/features/flash/flash
> > > > > > >  2092    995    929 6.6% target/classes/features/flash/taming
> > > > > > >  1020    466    472 -1.3%
> > > > target/classes/features/i18n/currencycodemap
> > > > > > >  5240   1505   1451 3.6%
> > > target/classes/features/i18n/datetimeformat
> > > > > > >  1915   1313   1356 -3.3%
> > > > > target/classes/features/i18n/datetimeformattest
> > > > > > >  9641   2408   2276 5.5%
> > target/classes/features/i18n/datetimeparse
> > > > > > >  2821   1838   1879 -2.2%
> > > > > target/classes/features/i18n/datetimeparsetest
> > > > > > >  2101    556    550 1.1%
> target/classes/features/i18n/formatting
> > > > > > >  5618   2514   2399 4.6%
> > target/classes/features/i18n/numberformat
> > > > > > >  2251   1567   1586 -1.2%
> > > > target/classes/features/i18n/numberformattest
> > > > > > >  2609    999    933 6.6%
> > > > > target/classes/features/minimessage/minimessage
> > > > > > >   660    175    172 1.7%
> > target/classes/features/minimessage/taming
> > > > > > >  2010    368    350 4.9%
> > > > target/classes/features/oauthpopup/oauthpopup
> > > > > > >  1695    727    723 0.6%
> > > > > > > target/classes/features/opensocial-0.6/opensocial6to7
> > > > > > >  1276    576    563 2.3%
> > > > > > > target/classes/features/opensocial-0.7/opensocial7to8
> > > > > > >   707    226    216 4.4%
> > > > > > > target/classes/features/opensocial-0.8/opensocial8to9
> > > > > > >  2184   1174   1099 6.4%
> > > > > > > target/classes/features/opensocial-base/fieldtranslations
> > > > > > >  1031    373    349 6.4%
> > > > > > > target/classes/features/opensocial-base/jsonactivity
> > > > > > >   731    191    186 2.6%
> > > > > > > target/classes/features/opensocial-base/jsonmessage
> > > > > > >   861    194    190 2.1%
> > > > > > > target/classes/features/opensocial-base/jsonmessagecollection
> > > > > > >  1186    580    548 5.5%
> > > > > > target/classes/features/opensocial-base/jsonperson
> > > > > > >  2310    660    601 8.9%
> > > > > > > target/classes/features/opensocial-data-context/datacontext
> > > > > > >  5767   2336   2216 5.1%
> > > target/classes/features/opensocial-data/data
> > > > > > >  4116   2596   2505 3.5%
> > > > > > > target/classes/features/opensocial-jsonrpc/jsonrpccontainer
> > > > > > >  3629    375    374 0.3%
> > > > > > > target/classes/features/opensocial-reference/activity
> > > > > > >  1343    290    290 0.0%
> > > > > > > target/classes/features/opensocial-reference/address
> > > > > > >  1093    195    194 0.5%
> > > > > > > target/classes/features/opensocial-reference/bodytype
> > > > > > >  1263    257    251 2.3%
> > > > > > > target/classes/features/opensocial-reference/collection
> > > > > > >  3997    673    607 9.8%
> > > > > > > target/classes/features/opensocial-reference/container
> > > > > > >  4130    798    774 3.0%
> > > > > > > target/classes/features/opensocial-reference/datarequest
> > > > > > >  1173    174    169 2.9%
> > > > > > > target/classes/features/opensocial-reference/dataresponse
> > > > > > >  1029    159    158 0.6%
> > > > > > target/classes/features/opensocial-reference/email
> > > > > > >  1726    381    384 -0.8%
> > > > > > target/classes/features/opensocial-reference/enum
> > > > > > >  1294    359    350 2.5%
> > > > > > > target/classes/features/opensocial-reference/environment
> > > > > > >  1590    264    260 1.5%
> > > > > > > target/classes/features/opensocial-reference/idspec
> > > > > > >  1318    286    278 2.8%
> > > > > > > target/classes/features/opensocial-reference/mediaitem
> > > > > > >  1893    452    452 0.0%
> > > > > > > target/classes/features/opensocial-reference/message
> > > > > > >  1213    214    212 0.9%
> > > > > > > target/classes/features/opensocial-reference/messagecollection
> > > > > > >  1096    247    245 0.8%
> > > > > > target/classes/features/opensocial-reference/name
> > > > > > >  1564    246    245 0.4%
> > > > > > >
> target/classes/features/opensocial-reference/navigationparameters
> > > > > > >  3858    606    592 2.3%
> > > > > > > target/classes/features/opensocial-reference/opensocial
> > > > > > >  1427    264    263 0.4%
> > > > > > > target/classes/features/opensocial-reference/organization
> > > > > > >  3389   1141   1138 0.3%
> > > > > > > target/classes/features/opensocial-reference/person
> > > > > > >  1029    157    156 0.6%
> > > > > > target/classes/features/opensocial-reference/phone
> > > > > > >  1556    333    330 0.9%
> > > > > > > target/classes/features/opensocial-reference/responseitem
> > > > > > >  1448    851    870 -2.2%
> > > > > > > target/classes/features/opensocial-reference/taming
> > > > > > >  1066    174    174 0.0%
> > > > > target/classes/features/opensocial-reference/url
> > > > > > >  4314   1595   1505 5.6%
> > > > > > target/classes/features/opensocial-templates/base
> > > > > > >  9647   3885   3672 5.5%
> > > > > > > target/classes/features/opensocial-templates/compiler
> > > > > > >  4375   1842   1714 6.9%
> > > > > > > target/classes/features/opensocial-templates/container
> > > > > > >  4153    978    905 7.5%
> > > > > > >
> > > target/classes/features/opensocial-templates/jsTemplate/jsevalcontext
> > > > > > >  9977   2767   2482 10.3%
> > > > > > >
> > target/classes/features/opensocial-templates/jsTemplate/jstemplate
> > > > > > >  4231   1122   1060 5.5%
> > > > > > > target/classes/features/opensocial-templates/jsTemplate/util
> > > > > > >  2989   1246   1143 8.3%
> > > > > > > target/classes/features/opensocial-templates/loader
> > > > > > >  1301    308    297 3.6%
> > > > > > > target/classes/features/opensocial-templates/namespaces
> > > > > > >  2559    919    824 10.3%
> > > > > target/classes/features/opensocial-templates/os
> > > > > > >  1644    645    620 3.9%
> > > > > > > target/classes/features/opensocial-templates/template
> > > > > > >  1441    386    360 6.7%
> > > > > > target/classes/features/opensocial-templates/util
> > > > > > >  1849    447    387 13.4% target/classes/features/osapi/batch
> > > > > > >  1920    505    466 7.7%
> > > > > > target/classes/features/osapi/gadgetsrpctransport
> > > > > > >  1401    551    508 7.8%
> > > > target/classes/features/osapi/jsonrpctransport
> > > > > > >  1158    388    360 7.2% target/classes/features/osapi/osapi
> > > > > > >   985    194    193 0.5%
> > > target/classes/features/osapi/peoplehelpers
> > > > > > >   989    336    328 2.4% target/classes/features/osapi/taming
> > > > > > >   981    227    210 7.5% target/classes/features/pubsub/pubsub
> > > > > > >  1415    454    412 9.3%
> > > target/classes/features/pubsub/pubsub-router
> > > > > > >   622    128    126 1.6% target/classes/features/pubsub/taming
> > > > > > >  1785    474    445 6.1%
> target/classes/features/rpc/fe.transport
> > > > > > >  2444    728    683 6.2%
> > target/classes/features/rpc/ifpc.transport
> > > > > > >  4045    887    840 5.3%
> > target/classes/features/rpc/nix.transport
> > > > > > >  6619   1420   1317 7.3%
> > target/classes/features/rpc/rmr.transport
> > > > > > >  9270   2292   2134 6.9% target/classes/features/rpc/rpc
> > > > > > >  1610    454    429 5.5%
> > target/classes/features/rpc/wpm.transport
> > > > > > >  1181    359    328 8.6%
> > target/classes/features/setprefs/setprefs
> > > > > > >   723    121    120 0.8%
> > target/classes/features/settitle/settitle
> > > > > > >   606    116    114 1.7%
> target/classes/features/settitle/taming
> > > > > > >  1226    253    242 4.3% target/classes/features/skins/skins
> > > > > > >   608    117    115 1.7% target/classes/features/skins/taming
> > > > > > >  5496   2640   2491 5.6% target/classes/features/tabs/tabs
> > > > > > >   716    223    222 0.4% target/classes/features/tabs/taming
> > > > > > >   705    215    212 1.4% target/classes/features/views/taming
> > > > > > >  3653   1643   1550 5.7% target/classes/features/views/views
> > > > > > >  1867    755    728 3.6%
> target/classes/features/xmlutil/xmlutil
> > > > > > > ---------------------------------------------------
> > > > > > > 238629  75921    728 5.1%
> > > > > > > YUI Better   : 6 (131)
> > > > > > > CC Better    : 92 (4017)
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
>

Re: experiments with closure compiler

Posted by Kevin Brown <et...@google.com>.
On Thu, Feb 4, 2010 at 10:34 AM, Evan Gilbert <ui...@google.com> wrote:

> On Wed, Jan 13, 2010 at 10:05 AM, Paul Lindner <li...@inuus.com> wrote:
>
> > I'm willing to use anything that helps reduce the size and improves the
> > quality of the js.  For optimal usage the tool should allow for a maven
> > plugin.
> >
> > In any case I think it might be interesting to generate externs.js files
> > for
> > each feature, and it might be interesting to concat the scripts for each
> > feature together for more code size reduction.
> >
>
> FYI - Closure Compiler has an @export annotation (couldn't find it
> documented, but source is here:
>
> http://www.google.com/codesearch/p?hl=en#l5BkQmivP-Y/trunk/src/com/google/javascript/jscomp/FindExportableNodes.java&q=com.google.javascript%20package:%22http://closure-compiler.googlecode.com/svn%22&d=5
> ).
>
> This may not work with the Shindig JS - not sure if the compiler is smart
> enough to understand the anonymous function syntax that creates our
> namespaces.
>

I don't think it does, but a fairly minor variation of what we're currently
doing should work.

Instead of:

namespace.package = function() {
  return {foo:foo, bar:bar};
}

just do the slightly more verbose:

function() {
  namespace.package = {};
  namespace.package.foo = ...
}();

The resulting object is the same, and functions that aren't a part of the
public interface will still be hidden in a closure.

The downside is that the uncompiled code is larger.


>
> >
> >
> > 2010/1/12 ๏̯͡๏ Jasvir Nagra <ja...@google.com>
> >
> > > YUI compressor compresses all valid input javascript correctly.
>  Closure
> > > compiler under simple mode accepts a subset of javascript and produces
> > > output that tries to be compatible with Caja's output semantics (
> > > http://code.google.com/closure/compiler/faq.html#caja).  If we are
> > willing
> > > to author in a subset of javascript, we should instead aim for the Caja
> > > subset (specifically the cajita subset).  The Caja Web Tools package (
> > >
> > >
> >
> http://code.google.com/p/google-caja/source/browse/#svn/trunk/src/com/google/caja/ancillary/opt
> > > )
> > > provides comparable compression as well as a linter and jsdoc tool.
>  The
> > > significant advantage over targetting closure compiler would be the
> > ability
> > > to inline gadgets on a page instead of iframing them.
> > >
> > > On Tue, Jan 12, 2010 at 1:37 PM, Paul Lindner <li...@inuus.com>
> wrote:
> > >
> > > > There isn't a closure compiler maven plugin quite yet.  Also be aware
> > > that
> > > > the closure compiler is quite slow.  However using it has uncovered a
> > > > number
> > > > of issues.  See the warnings I just attached to the jira issue.
> > > >
> > > >
> > > > On Tue, Jan 12, 2010 at 1:25 PM, John Hjelmstad <fa...@google.com>
> > > wrote:
> > > >
> > > > > Looks good. Do you have a CL for pom.xml updates as well that
> > switches
> > > > from
> > > > > YUI to CC?
> > > > >
> > > > > -j
> > > > >
> > > > > On Tue, Jan 12, 2010 at 1:20 PM, Paul Lindner <
> plindner@linkedin.com
> > >
> > > > > wrote:
> > > > >
> > > > > > With a large number of cleanups to the jsdoc I was able to get
> the
> > > > > shindig
> > > > > > javascript compiled using the closure compiler.  Overall there's
> a
> > 5%
> > > > > > reduction in gzip'd bytes (see table below)
> > > > > >
> > > > > > Normally closure compiler is not used piecemeal like this.
>  instead
> > > > it's
> > > > > > used on the entirety of a script.  Doing this for content from
> the
> > > > concat
> > > > > > servlet shows a 6% reduction in gzip'd bytes:
> > > > > >
> > > > > >   6671 Jan 12 12:34 rpc.cc.js.gz
> > > > > >   7116 Jan 12 12:34 rpc.opt.js.gz
> > > > > >  26427 Jan 12 12:32 if.cc.js.gz
> > > > > >  28171 Jan 12 12:30 if.opt.js.gz
> > > > > >
> > > > > >
> > > > > > To track the cleanups to the javascript I created
> > > > > > https://issues.apache.org/jira/browse/SHINDIG-1264  There's a
> bit
> > > more
> > > > > > remaining cleanup and some remaining outstanding warnings from my
> > > > build.
> > > > > >
> > > > > > REDUCTION IN GZIP BYTES
> > > > > >
> > > > > >  orig    yui     cc diff fname
> > > > > >   595    104    103 1.0%
> > > > > target/classes/features/auth-refresh/auth-refresh
> > > > > >  2654    446    370 17.0% target/classes/features/core.auth/auth
> > > > > >   542     59     57 3.4%
> > target/classes/features/core.auth/auth-init
> > > > > >  2883    590    545 7.6%
> target/classes/features/core.config/config
> > > > > >  5266   2647   2285 13.7% target/classes/features/core.io/io
> > > > > >   631    143    141 1.4% target/classes/features/core.io/taming
> > > > > >  2726    842    797 5.3% target/classes/features/core.json/json
> > > > > >   614    124    122 1.6% target/classes/features/core.json/taming
> > > > > >  3063   1347   1247 7.4%
> target/classes/features/core.legacy/legacy
> > > > > >  1220    303    288 5.0% target/classes/features/core.log/log
> > > > > >   671    189    186 1.6% target/classes/features/core.log/taming
> > > > > >  2575    777    725 6.7% target/classes/features/core.prefs/prefs
> > > > > >   676    186    184 1.1%
> target/classes/features/core.prefs/taming
> > > > > >   653    168    166 1.2% target/classes/features/core.util/taming
> > > > > >  3544    991    926 6.6% target/classes/features/core.util/util
> > > > > >   984    217    208 4.1%
> > > > > > target/classes/features/dynamic-height.util/dynamic-height-util
> > > > > >  2593    675    633 6.2%
> > > > > > target/classes/features/dynamic-height/dynamic-height
> > > > > >   630    144    141 2.1%
> > > target/classes/features/dynamic-height/taming
> > > > > >  2638   1116   1054 5.6% target/classes/features/flash/flash
> > > > > >  2092    995    929 6.6% target/classes/features/flash/taming
> > > > > >  1020    466    472 -1.3%
> > > target/classes/features/i18n/currencycodemap
> > > > > >  5240   1505   1451 3.6%
> > target/classes/features/i18n/datetimeformat
> > > > > >  1915   1313   1356 -3.3%
> > > > target/classes/features/i18n/datetimeformattest
> > > > > >  9641   2408   2276 5.5%
> target/classes/features/i18n/datetimeparse
> > > > > >  2821   1838   1879 -2.2%
> > > > target/classes/features/i18n/datetimeparsetest
> > > > > >  2101    556    550 1.1% target/classes/features/i18n/formatting
> > > > > >  5618   2514   2399 4.6%
> target/classes/features/i18n/numberformat
> > > > > >  2251   1567   1586 -1.2%
> > > target/classes/features/i18n/numberformattest
> > > > > >  2609    999    933 6.6%
> > > > target/classes/features/minimessage/minimessage
> > > > > >   660    175    172 1.7%
> target/classes/features/minimessage/taming
> > > > > >  2010    368    350 4.9%
> > > target/classes/features/oauthpopup/oauthpopup
> > > > > >  1695    727    723 0.6%
> > > > > > target/classes/features/opensocial-0.6/opensocial6to7
> > > > > >  1276    576    563 2.3%
> > > > > > target/classes/features/opensocial-0.7/opensocial7to8
> > > > > >   707    226    216 4.4%
> > > > > > target/classes/features/opensocial-0.8/opensocial8to9
> > > > > >  2184   1174   1099 6.4%
> > > > > > target/classes/features/opensocial-base/fieldtranslations
> > > > > >  1031    373    349 6.4%
> > > > > > target/classes/features/opensocial-base/jsonactivity
> > > > > >   731    191    186 2.6%
> > > > > > target/classes/features/opensocial-base/jsonmessage
> > > > > >   861    194    190 2.1%
> > > > > > target/classes/features/opensocial-base/jsonmessagecollection
> > > > > >  1186    580    548 5.5%
> > > > > target/classes/features/opensocial-base/jsonperson
> > > > > >  2310    660    601 8.9%
> > > > > > target/classes/features/opensocial-data-context/datacontext
> > > > > >  5767   2336   2216 5.1%
> > target/classes/features/opensocial-data/data
> > > > > >  4116   2596   2505 3.5%
> > > > > > target/classes/features/opensocial-jsonrpc/jsonrpccontainer
> > > > > >  3629    375    374 0.3%
> > > > > > target/classes/features/opensocial-reference/activity
> > > > > >  1343    290    290 0.0%
> > > > > > target/classes/features/opensocial-reference/address
> > > > > >  1093    195    194 0.5%
> > > > > > target/classes/features/opensocial-reference/bodytype
> > > > > >  1263    257    251 2.3%
> > > > > > target/classes/features/opensocial-reference/collection
> > > > > >  3997    673    607 9.8%
> > > > > > target/classes/features/opensocial-reference/container
> > > > > >  4130    798    774 3.0%
> > > > > > target/classes/features/opensocial-reference/datarequest
> > > > > >  1173    174    169 2.9%
> > > > > > target/classes/features/opensocial-reference/dataresponse
> > > > > >  1029    159    158 0.6%
> > > > > target/classes/features/opensocial-reference/email
> > > > > >  1726    381    384 -0.8%
> > > > > target/classes/features/opensocial-reference/enum
> > > > > >  1294    359    350 2.5%
> > > > > > target/classes/features/opensocial-reference/environment
> > > > > >  1590    264    260 1.5%
> > > > > > target/classes/features/opensocial-reference/idspec
> > > > > >  1318    286    278 2.8%
> > > > > > target/classes/features/opensocial-reference/mediaitem
> > > > > >  1893    452    452 0.0%
> > > > > > target/classes/features/opensocial-reference/message
> > > > > >  1213    214    212 0.9%
> > > > > > target/classes/features/opensocial-reference/messagecollection
> > > > > >  1096    247    245 0.8%
> > > > > target/classes/features/opensocial-reference/name
> > > > > >  1564    246    245 0.4%
> > > > > > target/classes/features/opensocial-reference/navigationparameters
> > > > > >  3858    606    592 2.3%
> > > > > > target/classes/features/opensocial-reference/opensocial
> > > > > >  1427    264    263 0.4%
> > > > > > target/classes/features/opensocial-reference/organization
> > > > > >  3389   1141   1138 0.3%
> > > > > > target/classes/features/opensocial-reference/person
> > > > > >  1029    157    156 0.6%
> > > > > target/classes/features/opensocial-reference/phone
> > > > > >  1556    333    330 0.9%
> > > > > > target/classes/features/opensocial-reference/responseitem
> > > > > >  1448    851    870 -2.2%
> > > > > > target/classes/features/opensocial-reference/taming
> > > > > >  1066    174    174 0.0%
> > > > target/classes/features/opensocial-reference/url
> > > > > >  4314   1595   1505 5.6%
> > > > > target/classes/features/opensocial-templates/base
> > > > > >  9647   3885   3672 5.5%
> > > > > > target/classes/features/opensocial-templates/compiler
> > > > > >  4375   1842   1714 6.9%
> > > > > > target/classes/features/opensocial-templates/container
> > > > > >  4153    978    905 7.5%
> > > > > >
> > target/classes/features/opensocial-templates/jsTemplate/jsevalcontext
> > > > > >  9977   2767   2482 10.3%
> > > > > >
> target/classes/features/opensocial-templates/jsTemplate/jstemplate
> > > > > >  4231   1122   1060 5.5%
> > > > > > target/classes/features/opensocial-templates/jsTemplate/util
> > > > > >  2989   1246   1143 8.3%
> > > > > > target/classes/features/opensocial-templates/loader
> > > > > >  1301    308    297 3.6%
> > > > > > target/classes/features/opensocial-templates/namespaces
> > > > > >  2559    919    824 10.3%
> > > > target/classes/features/opensocial-templates/os
> > > > > >  1644    645    620 3.9%
> > > > > > target/classes/features/opensocial-templates/template
> > > > > >  1441    386    360 6.7%
> > > > > target/classes/features/opensocial-templates/util
> > > > > >  1849    447    387 13.4% target/classes/features/osapi/batch
> > > > > >  1920    505    466 7.7%
> > > > > target/classes/features/osapi/gadgetsrpctransport
> > > > > >  1401    551    508 7.8%
> > > target/classes/features/osapi/jsonrpctransport
> > > > > >  1158    388    360 7.2% target/classes/features/osapi/osapi
> > > > > >   985    194    193 0.5%
> > target/classes/features/osapi/peoplehelpers
> > > > > >   989    336    328 2.4% target/classes/features/osapi/taming
> > > > > >   981    227    210 7.5% target/classes/features/pubsub/pubsub
> > > > > >  1415    454    412 9.3%
> > target/classes/features/pubsub/pubsub-router
> > > > > >   622    128    126 1.6% target/classes/features/pubsub/taming
> > > > > >  1785    474    445 6.1% target/classes/features/rpc/fe.transport
> > > > > >  2444    728    683 6.2%
> target/classes/features/rpc/ifpc.transport
> > > > > >  4045    887    840 5.3%
> target/classes/features/rpc/nix.transport
> > > > > >  6619   1420   1317 7.3%
> target/classes/features/rpc/rmr.transport
> > > > > >  9270   2292   2134 6.9% target/classes/features/rpc/rpc
> > > > > >  1610    454    429 5.5%
> target/classes/features/rpc/wpm.transport
> > > > > >  1181    359    328 8.6%
> target/classes/features/setprefs/setprefs
> > > > > >   723    121    120 0.8%
> target/classes/features/settitle/settitle
> > > > > >   606    116    114 1.7% target/classes/features/settitle/taming
> > > > > >  1226    253    242 4.3% target/classes/features/skins/skins
> > > > > >   608    117    115 1.7% target/classes/features/skins/taming
> > > > > >  5496   2640   2491 5.6% target/classes/features/tabs/tabs
> > > > > >   716    223    222 0.4% target/classes/features/tabs/taming
> > > > > >   705    215    212 1.4% target/classes/features/views/taming
> > > > > >  3653   1643   1550 5.7% target/classes/features/views/views
> > > > > >  1867    755    728 3.6% target/classes/features/xmlutil/xmlutil
> > > > > > ---------------------------------------------------
> > > > > > 238629  75921    728 5.1%
> > > > > > YUI Better   : 6 (131)
> > > > > > CC Better    : 92 (4017)
> > > > > >
> > > > >
> > > >
> > >
> >
>

Re: experiments with closure compiler

Posted by Evan Gilbert <ui...@google.com>.
On Wed, Jan 13, 2010 at 10:05 AM, Paul Lindner <li...@inuus.com> wrote:

> I'm willing to use anything that helps reduce the size and improves the
> quality of the js.  For optimal usage the tool should allow for a maven
> plugin.
>
> In any case I think it might be interesting to generate externs.js files
> for
> each feature, and it might be interesting to concat the scripts for each
> feature together for more code size reduction.
>

FYI - Closure Compiler has an @export annotation (couldn't find it
documented, but source is here:
http://www.google.com/codesearch/p?hl=en#l5BkQmivP-Y/trunk/src/com/google/javascript/jscomp/FindExportableNodes.java&q=com.google.javascript%20package:%22http://closure-compiler.googlecode.com/svn%22&d=5
).

This may not work with the Shindig JS - not sure if the compiler is smart
enough to understand the anonymous function syntax that creates our
namespaces.


>
>
> 2010/1/12 ๏̯͡๏ Jasvir Nagra <ja...@google.com>
>
> > YUI compressor compresses all valid input javascript correctly.  Closure
> > compiler under simple mode accepts a subset of javascript and produces
> > output that tries to be compatible with Caja's output semantics (
> > http://code.google.com/closure/compiler/faq.html#caja).  If we are
> willing
> > to author in a subset of javascript, we should instead aim for the Caja
> > subset (specifically the cajita subset).  The Caja Web Tools package (
> >
> >
> http://code.google.com/p/google-caja/source/browse/#svn/trunk/src/com/google/caja/ancillary/opt
> > )
> > provides comparable compression as well as a linter and jsdoc tool.  The
> > significant advantage over targetting closure compiler would be the
> ability
> > to inline gadgets on a page instead of iframing them.
> >
> > On Tue, Jan 12, 2010 at 1:37 PM, Paul Lindner <li...@inuus.com> wrote:
> >
> > > There isn't a closure compiler maven plugin quite yet.  Also be aware
> > that
> > > the closure compiler is quite slow.  However using it has uncovered a
> > > number
> > > of issues.  See the warnings I just attached to the jira issue.
> > >
> > >
> > > On Tue, Jan 12, 2010 at 1:25 PM, John Hjelmstad <fa...@google.com>
> > wrote:
> > >
> > > > Looks good. Do you have a CL for pom.xml updates as well that
> switches
> > > from
> > > > YUI to CC?
> > > >
> > > > -j
> > > >
> > > > On Tue, Jan 12, 2010 at 1:20 PM, Paul Lindner <plindner@linkedin.com
> >
> > > > wrote:
> > > >
> > > > > With a large number of cleanups to the jsdoc I was able to get the
> > > > shindig
> > > > > javascript compiled using the closure compiler.  Overall there's a
> 5%
> > > > > reduction in gzip'd bytes (see table below)
> > > > >
> > > > > Normally closure compiler is not used piecemeal like this.  instead
> > > it's
> > > > > used on the entirety of a script.  Doing this for content from the
> > > concat
> > > > > servlet shows a 6% reduction in gzip'd bytes:
> > > > >
> > > > >   6671 Jan 12 12:34 rpc.cc.js.gz
> > > > >   7116 Jan 12 12:34 rpc.opt.js.gz
> > > > >  26427 Jan 12 12:32 if.cc.js.gz
> > > > >  28171 Jan 12 12:30 if.opt.js.gz
> > > > >
> > > > >
> > > > > To track the cleanups to the javascript I created
> > > > > https://issues.apache.org/jira/browse/SHINDIG-1264  There's a bit
> > more
> > > > > remaining cleanup and some remaining outstanding warnings from my
> > > build.
> > > > >
> > > > > REDUCTION IN GZIP BYTES
> > > > >
> > > > >  orig    yui     cc diff fname
> > > > >   595    104    103 1.0%
> > > > target/classes/features/auth-refresh/auth-refresh
> > > > >  2654    446    370 17.0% target/classes/features/core.auth/auth
> > > > >   542     59     57 3.4%
> target/classes/features/core.auth/auth-init
> > > > >  2883    590    545 7.6% target/classes/features/core.config/config
> > > > >  5266   2647   2285 13.7% target/classes/features/core.io/io
> > > > >   631    143    141 1.4% target/classes/features/core.io/taming
> > > > >  2726    842    797 5.3% target/classes/features/core.json/json
> > > > >   614    124    122 1.6% target/classes/features/core.json/taming
> > > > >  3063   1347   1247 7.4% target/classes/features/core.legacy/legacy
> > > > >  1220    303    288 5.0% target/classes/features/core.log/log
> > > > >   671    189    186 1.6% target/classes/features/core.log/taming
> > > > >  2575    777    725 6.7% target/classes/features/core.prefs/prefs
> > > > >   676    186    184 1.1% target/classes/features/core.prefs/taming
> > > > >   653    168    166 1.2% target/classes/features/core.util/taming
> > > > >  3544    991    926 6.6% target/classes/features/core.util/util
> > > > >   984    217    208 4.1%
> > > > > target/classes/features/dynamic-height.util/dynamic-height-util
> > > > >  2593    675    633 6.2%
> > > > > target/classes/features/dynamic-height/dynamic-height
> > > > >   630    144    141 2.1%
> > target/classes/features/dynamic-height/taming
> > > > >  2638   1116   1054 5.6% target/classes/features/flash/flash
> > > > >  2092    995    929 6.6% target/classes/features/flash/taming
> > > > >  1020    466    472 -1.3%
> > target/classes/features/i18n/currencycodemap
> > > > >  5240   1505   1451 3.6%
> target/classes/features/i18n/datetimeformat
> > > > >  1915   1313   1356 -3.3%
> > > target/classes/features/i18n/datetimeformattest
> > > > >  9641   2408   2276 5.5% target/classes/features/i18n/datetimeparse
> > > > >  2821   1838   1879 -2.2%
> > > target/classes/features/i18n/datetimeparsetest
> > > > >  2101    556    550 1.1% target/classes/features/i18n/formatting
> > > > >  5618   2514   2399 4.6% target/classes/features/i18n/numberformat
> > > > >  2251   1567   1586 -1.2%
> > target/classes/features/i18n/numberformattest
> > > > >  2609    999    933 6.6%
> > > target/classes/features/minimessage/minimessage
> > > > >   660    175    172 1.7% target/classes/features/minimessage/taming
> > > > >  2010    368    350 4.9%
> > target/classes/features/oauthpopup/oauthpopup
> > > > >  1695    727    723 0.6%
> > > > > target/classes/features/opensocial-0.6/opensocial6to7
> > > > >  1276    576    563 2.3%
> > > > > target/classes/features/opensocial-0.7/opensocial7to8
> > > > >   707    226    216 4.4%
> > > > > target/classes/features/opensocial-0.8/opensocial8to9
> > > > >  2184   1174   1099 6.4%
> > > > > target/classes/features/opensocial-base/fieldtranslations
> > > > >  1031    373    349 6.4%
> > > > > target/classes/features/opensocial-base/jsonactivity
> > > > >   731    191    186 2.6%
> > > > > target/classes/features/opensocial-base/jsonmessage
> > > > >   861    194    190 2.1%
> > > > > target/classes/features/opensocial-base/jsonmessagecollection
> > > > >  1186    580    548 5.5%
> > > > target/classes/features/opensocial-base/jsonperson
> > > > >  2310    660    601 8.9%
> > > > > target/classes/features/opensocial-data-context/datacontext
> > > > >  5767   2336   2216 5.1%
> target/classes/features/opensocial-data/data
> > > > >  4116   2596   2505 3.5%
> > > > > target/classes/features/opensocial-jsonrpc/jsonrpccontainer
> > > > >  3629    375    374 0.3%
> > > > > target/classes/features/opensocial-reference/activity
> > > > >  1343    290    290 0.0%
> > > > > target/classes/features/opensocial-reference/address
> > > > >  1093    195    194 0.5%
> > > > > target/classes/features/opensocial-reference/bodytype
> > > > >  1263    257    251 2.3%
> > > > > target/classes/features/opensocial-reference/collection
> > > > >  3997    673    607 9.8%
> > > > > target/classes/features/opensocial-reference/container
> > > > >  4130    798    774 3.0%
> > > > > target/classes/features/opensocial-reference/datarequest
> > > > >  1173    174    169 2.9%
> > > > > target/classes/features/opensocial-reference/dataresponse
> > > > >  1029    159    158 0.6%
> > > > target/classes/features/opensocial-reference/email
> > > > >  1726    381    384 -0.8%
> > > > target/classes/features/opensocial-reference/enum
> > > > >  1294    359    350 2.5%
> > > > > target/classes/features/opensocial-reference/environment
> > > > >  1590    264    260 1.5%
> > > > > target/classes/features/opensocial-reference/idspec
> > > > >  1318    286    278 2.8%
> > > > > target/classes/features/opensocial-reference/mediaitem
> > > > >  1893    452    452 0.0%
> > > > > target/classes/features/opensocial-reference/message
> > > > >  1213    214    212 0.9%
> > > > > target/classes/features/opensocial-reference/messagecollection
> > > > >  1096    247    245 0.8%
> > > > target/classes/features/opensocial-reference/name
> > > > >  1564    246    245 0.4%
> > > > > target/classes/features/opensocial-reference/navigationparameters
> > > > >  3858    606    592 2.3%
> > > > > target/classes/features/opensocial-reference/opensocial
> > > > >  1427    264    263 0.4%
> > > > > target/classes/features/opensocial-reference/organization
> > > > >  3389   1141   1138 0.3%
> > > > > target/classes/features/opensocial-reference/person
> > > > >  1029    157    156 0.6%
> > > > target/classes/features/opensocial-reference/phone
> > > > >  1556    333    330 0.9%
> > > > > target/classes/features/opensocial-reference/responseitem
> > > > >  1448    851    870 -2.2%
> > > > > target/classes/features/opensocial-reference/taming
> > > > >  1066    174    174 0.0%
> > > target/classes/features/opensocial-reference/url
> > > > >  4314   1595   1505 5.6%
> > > > target/classes/features/opensocial-templates/base
> > > > >  9647   3885   3672 5.5%
> > > > > target/classes/features/opensocial-templates/compiler
> > > > >  4375   1842   1714 6.9%
> > > > > target/classes/features/opensocial-templates/container
> > > > >  4153    978    905 7.5%
> > > > >
> target/classes/features/opensocial-templates/jsTemplate/jsevalcontext
> > > > >  9977   2767   2482 10.3%
> > > > > target/classes/features/opensocial-templates/jsTemplate/jstemplate
> > > > >  4231   1122   1060 5.5%
> > > > > target/classes/features/opensocial-templates/jsTemplate/util
> > > > >  2989   1246   1143 8.3%
> > > > > target/classes/features/opensocial-templates/loader
> > > > >  1301    308    297 3.6%
> > > > > target/classes/features/opensocial-templates/namespaces
> > > > >  2559    919    824 10.3%
> > > target/classes/features/opensocial-templates/os
> > > > >  1644    645    620 3.9%
> > > > > target/classes/features/opensocial-templates/template
> > > > >  1441    386    360 6.7%
> > > > target/classes/features/opensocial-templates/util
> > > > >  1849    447    387 13.4% target/classes/features/osapi/batch
> > > > >  1920    505    466 7.7%
> > > > target/classes/features/osapi/gadgetsrpctransport
> > > > >  1401    551    508 7.8%
> > target/classes/features/osapi/jsonrpctransport
> > > > >  1158    388    360 7.2% target/classes/features/osapi/osapi
> > > > >   985    194    193 0.5%
> target/classes/features/osapi/peoplehelpers
> > > > >   989    336    328 2.4% target/classes/features/osapi/taming
> > > > >   981    227    210 7.5% target/classes/features/pubsub/pubsub
> > > > >  1415    454    412 9.3%
> target/classes/features/pubsub/pubsub-router
> > > > >   622    128    126 1.6% target/classes/features/pubsub/taming
> > > > >  1785    474    445 6.1% target/classes/features/rpc/fe.transport
> > > > >  2444    728    683 6.2% target/classes/features/rpc/ifpc.transport
> > > > >  4045    887    840 5.3% target/classes/features/rpc/nix.transport
> > > > >  6619   1420   1317 7.3% target/classes/features/rpc/rmr.transport
> > > > >  9270   2292   2134 6.9% target/classes/features/rpc/rpc
> > > > >  1610    454    429 5.5% target/classes/features/rpc/wpm.transport
> > > > >  1181    359    328 8.6% target/classes/features/setprefs/setprefs
> > > > >   723    121    120 0.8% target/classes/features/settitle/settitle
> > > > >   606    116    114 1.7% target/classes/features/settitle/taming
> > > > >  1226    253    242 4.3% target/classes/features/skins/skins
> > > > >   608    117    115 1.7% target/classes/features/skins/taming
> > > > >  5496   2640   2491 5.6% target/classes/features/tabs/tabs
> > > > >   716    223    222 0.4% target/classes/features/tabs/taming
> > > > >   705    215    212 1.4% target/classes/features/views/taming
> > > > >  3653   1643   1550 5.7% target/classes/features/views/views
> > > > >  1867    755    728 3.6% target/classes/features/xmlutil/xmlutil
> > > > > ---------------------------------------------------
> > > > > 238629  75921    728 5.1%
> > > > > YUI Better   : 6 (131)
> > > > > CC Better    : 92 (4017)
> > > > >
> > > >
> > >
> >
>

Re: experiments with closure compiler

Posted by Paul Lindner <li...@inuus.com>.
I'm willing to use anything that helps reduce the size and improves the
quality of the js.  For optimal usage the tool should allow for a maven
plugin.

In any case I think it might be interesting to generate externs.js files for
each feature, and it might be interesting to concat the scripts for each
feature together for more code size reduction.


2010/1/12 ๏̯͡๏ Jasvir Nagra <ja...@google.com>

> YUI compressor compresses all valid input javascript correctly.  Closure
> compiler under simple mode accepts a subset of javascript and produces
> output that tries to be compatible with Caja's output semantics (
> http://code.google.com/closure/compiler/faq.html#caja).  If we are willing
> to author in a subset of javascript, we should instead aim for the Caja
> subset (specifically the cajita subset).  The Caja Web Tools package (
>
> http://code.google.com/p/google-caja/source/browse/#svn/trunk/src/com/google/caja/ancillary/opt
> )
> provides comparable compression as well as a linter and jsdoc tool.  The
> significant advantage over targetting closure compiler would be the ability
> to inline gadgets on a page instead of iframing them.
>
> On Tue, Jan 12, 2010 at 1:37 PM, Paul Lindner <li...@inuus.com> wrote:
>
> > There isn't a closure compiler maven plugin quite yet.  Also be aware
> that
> > the closure compiler is quite slow.  However using it has uncovered a
> > number
> > of issues.  See the warnings I just attached to the jira issue.
> >
> >
> > On Tue, Jan 12, 2010 at 1:25 PM, John Hjelmstad <fa...@google.com>
> wrote:
> >
> > > Looks good. Do you have a CL for pom.xml updates as well that switches
> > from
> > > YUI to CC?
> > >
> > > -j
> > >
> > > On Tue, Jan 12, 2010 at 1:20 PM, Paul Lindner <pl...@linkedin.com>
> > > wrote:
> > >
> > > > With a large number of cleanups to the jsdoc I was able to get the
> > > shindig
> > > > javascript compiled using the closure compiler.  Overall there's a 5%
> > > > reduction in gzip'd bytes (see table below)
> > > >
> > > > Normally closure compiler is not used piecemeal like this.  instead
> > it's
> > > > used on the entirety of a script.  Doing this for content from the
> > concat
> > > > servlet shows a 6% reduction in gzip'd bytes:
> > > >
> > > >   6671 Jan 12 12:34 rpc.cc.js.gz
> > > >   7116 Jan 12 12:34 rpc.opt.js.gz
> > > >  26427 Jan 12 12:32 if.cc.js.gz
> > > >  28171 Jan 12 12:30 if.opt.js.gz
> > > >
> > > >
> > > > To track the cleanups to the javascript I created
> > > > https://issues.apache.org/jira/browse/SHINDIG-1264  There's a bit
> more
> > > > remaining cleanup and some remaining outstanding warnings from my
> > build.
> > > >
> > > > REDUCTION IN GZIP BYTES
> > > >
> > > >  orig    yui     cc diff fname
> > > >   595    104    103 1.0%
> > > target/classes/features/auth-refresh/auth-refresh
> > > >  2654    446    370 17.0% target/classes/features/core.auth/auth
> > > >   542     59     57 3.4% target/classes/features/core.auth/auth-init
> > > >  2883    590    545 7.6% target/classes/features/core.config/config
> > > >  5266   2647   2285 13.7% target/classes/features/core.io/io
> > > >   631    143    141 1.4% target/classes/features/core.io/taming
> > > >  2726    842    797 5.3% target/classes/features/core.json/json
> > > >   614    124    122 1.6% target/classes/features/core.json/taming
> > > >  3063   1347   1247 7.4% target/classes/features/core.legacy/legacy
> > > >  1220    303    288 5.0% target/classes/features/core.log/log
> > > >   671    189    186 1.6% target/classes/features/core.log/taming
> > > >  2575    777    725 6.7% target/classes/features/core.prefs/prefs
> > > >   676    186    184 1.1% target/classes/features/core.prefs/taming
> > > >   653    168    166 1.2% target/classes/features/core.util/taming
> > > >  3544    991    926 6.6% target/classes/features/core.util/util
> > > >   984    217    208 4.1%
> > > > target/classes/features/dynamic-height.util/dynamic-height-util
> > > >  2593    675    633 6.2%
> > > > target/classes/features/dynamic-height/dynamic-height
> > > >   630    144    141 2.1%
> target/classes/features/dynamic-height/taming
> > > >  2638   1116   1054 5.6% target/classes/features/flash/flash
> > > >  2092    995    929 6.6% target/classes/features/flash/taming
> > > >  1020    466    472 -1.3%
> target/classes/features/i18n/currencycodemap
> > > >  5240   1505   1451 3.6% target/classes/features/i18n/datetimeformat
> > > >  1915   1313   1356 -3.3%
> > target/classes/features/i18n/datetimeformattest
> > > >  9641   2408   2276 5.5% target/classes/features/i18n/datetimeparse
> > > >  2821   1838   1879 -2.2%
> > target/classes/features/i18n/datetimeparsetest
> > > >  2101    556    550 1.1% target/classes/features/i18n/formatting
> > > >  5618   2514   2399 4.6% target/classes/features/i18n/numberformat
> > > >  2251   1567   1586 -1.2%
> target/classes/features/i18n/numberformattest
> > > >  2609    999    933 6.6%
> > target/classes/features/minimessage/minimessage
> > > >   660    175    172 1.7% target/classes/features/minimessage/taming
> > > >  2010    368    350 4.9%
> target/classes/features/oauthpopup/oauthpopup
> > > >  1695    727    723 0.6%
> > > > target/classes/features/opensocial-0.6/opensocial6to7
> > > >  1276    576    563 2.3%
> > > > target/classes/features/opensocial-0.7/opensocial7to8
> > > >   707    226    216 4.4%
> > > > target/classes/features/opensocial-0.8/opensocial8to9
> > > >  2184   1174   1099 6.4%
> > > > target/classes/features/opensocial-base/fieldtranslations
> > > >  1031    373    349 6.4%
> > > > target/classes/features/opensocial-base/jsonactivity
> > > >   731    191    186 2.6%
> > > > target/classes/features/opensocial-base/jsonmessage
> > > >   861    194    190 2.1%
> > > > target/classes/features/opensocial-base/jsonmessagecollection
> > > >  1186    580    548 5.5%
> > > target/classes/features/opensocial-base/jsonperson
> > > >  2310    660    601 8.9%
> > > > target/classes/features/opensocial-data-context/datacontext
> > > >  5767   2336   2216 5.1% target/classes/features/opensocial-data/data
> > > >  4116   2596   2505 3.5%
> > > > target/classes/features/opensocial-jsonrpc/jsonrpccontainer
> > > >  3629    375    374 0.3%
> > > > target/classes/features/opensocial-reference/activity
> > > >  1343    290    290 0.0%
> > > > target/classes/features/opensocial-reference/address
> > > >  1093    195    194 0.5%
> > > > target/classes/features/opensocial-reference/bodytype
> > > >  1263    257    251 2.3%
> > > > target/classes/features/opensocial-reference/collection
> > > >  3997    673    607 9.8%
> > > > target/classes/features/opensocial-reference/container
> > > >  4130    798    774 3.0%
> > > > target/classes/features/opensocial-reference/datarequest
> > > >  1173    174    169 2.9%
> > > > target/classes/features/opensocial-reference/dataresponse
> > > >  1029    159    158 0.6%
> > > target/classes/features/opensocial-reference/email
> > > >  1726    381    384 -0.8%
> > > target/classes/features/opensocial-reference/enum
> > > >  1294    359    350 2.5%
> > > > target/classes/features/opensocial-reference/environment
> > > >  1590    264    260 1.5%
> > > > target/classes/features/opensocial-reference/idspec
> > > >  1318    286    278 2.8%
> > > > target/classes/features/opensocial-reference/mediaitem
> > > >  1893    452    452 0.0%
> > > > target/classes/features/opensocial-reference/message
> > > >  1213    214    212 0.9%
> > > > target/classes/features/opensocial-reference/messagecollection
> > > >  1096    247    245 0.8%
> > > target/classes/features/opensocial-reference/name
> > > >  1564    246    245 0.4%
> > > > target/classes/features/opensocial-reference/navigationparameters
> > > >  3858    606    592 2.3%
> > > > target/classes/features/opensocial-reference/opensocial
> > > >  1427    264    263 0.4%
> > > > target/classes/features/opensocial-reference/organization
> > > >  3389   1141   1138 0.3%
> > > > target/classes/features/opensocial-reference/person
> > > >  1029    157    156 0.6%
> > > target/classes/features/opensocial-reference/phone
> > > >  1556    333    330 0.9%
> > > > target/classes/features/opensocial-reference/responseitem
> > > >  1448    851    870 -2.2%
> > > > target/classes/features/opensocial-reference/taming
> > > >  1066    174    174 0.0%
> > target/classes/features/opensocial-reference/url
> > > >  4314   1595   1505 5.6%
> > > target/classes/features/opensocial-templates/base
> > > >  9647   3885   3672 5.5%
> > > > target/classes/features/opensocial-templates/compiler
> > > >  4375   1842   1714 6.9%
> > > > target/classes/features/opensocial-templates/container
> > > >  4153    978    905 7.5%
> > > > target/classes/features/opensocial-templates/jsTemplate/jsevalcontext
> > > >  9977   2767   2482 10.3%
> > > > target/classes/features/opensocial-templates/jsTemplate/jstemplate
> > > >  4231   1122   1060 5.5%
> > > > target/classes/features/opensocial-templates/jsTemplate/util
> > > >  2989   1246   1143 8.3%
> > > > target/classes/features/opensocial-templates/loader
> > > >  1301    308    297 3.6%
> > > > target/classes/features/opensocial-templates/namespaces
> > > >  2559    919    824 10.3%
> > target/classes/features/opensocial-templates/os
> > > >  1644    645    620 3.9%
> > > > target/classes/features/opensocial-templates/template
> > > >  1441    386    360 6.7%
> > > target/classes/features/opensocial-templates/util
> > > >  1849    447    387 13.4% target/classes/features/osapi/batch
> > > >  1920    505    466 7.7%
> > > target/classes/features/osapi/gadgetsrpctransport
> > > >  1401    551    508 7.8%
> target/classes/features/osapi/jsonrpctransport
> > > >  1158    388    360 7.2% target/classes/features/osapi/osapi
> > > >   985    194    193 0.5% target/classes/features/osapi/peoplehelpers
> > > >   989    336    328 2.4% target/classes/features/osapi/taming
> > > >   981    227    210 7.5% target/classes/features/pubsub/pubsub
> > > >  1415    454    412 9.3% target/classes/features/pubsub/pubsub-router
> > > >   622    128    126 1.6% target/classes/features/pubsub/taming
> > > >  1785    474    445 6.1% target/classes/features/rpc/fe.transport
> > > >  2444    728    683 6.2% target/classes/features/rpc/ifpc.transport
> > > >  4045    887    840 5.3% target/classes/features/rpc/nix.transport
> > > >  6619   1420   1317 7.3% target/classes/features/rpc/rmr.transport
> > > >  9270   2292   2134 6.9% target/classes/features/rpc/rpc
> > > >  1610    454    429 5.5% target/classes/features/rpc/wpm.transport
> > > >  1181    359    328 8.6% target/classes/features/setprefs/setprefs
> > > >   723    121    120 0.8% target/classes/features/settitle/settitle
> > > >   606    116    114 1.7% target/classes/features/settitle/taming
> > > >  1226    253    242 4.3% target/classes/features/skins/skins
> > > >   608    117    115 1.7% target/classes/features/skins/taming
> > > >  5496   2640   2491 5.6% target/classes/features/tabs/tabs
> > > >   716    223    222 0.4% target/classes/features/tabs/taming
> > > >   705    215    212 1.4% target/classes/features/views/taming
> > > >  3653   1643   1550 5.7% target/classes/features/views/views
> > > >  1867    755    728 3.6% target/classes/features/xmlutil/xmlutil
> > > > ---------------------------------------------------
> > > > 238629  75921    728 5.1%
> > > > YUI Better   : 6 (131)
> > > > CC Better    : 92 (4017)
> > > >
> > >
> >
>

Re: experiments with closure compiler

Posted by ๏̯͡๏ Jasvir Nagra <ja...@google.com>.
YUI compressor compresses all valid input javascript correctly.  Closure
compiler under simple mode accepts a subset of javascript and produces
output that tries to be compatible with Caja's output semantics (
http://code.google.com/closure/compiler/faq.html#caja).  If we are willing
to author in a subset of javascript, we should instead aim for the Caja
subset (specifically the cajita subset).  The Caja Web Tools package (
http://code.google.com/p/google-caja/source/browse/#svn/trunk/src/com/google/caja/ancillary/opt)
provides comparable compression as well as a linter and jsdoc tool.  The
significant advantage over targetting closure compiler would be the ability
to inline gadgets on a page instead of iframing them.

On Tue, Jan 12, 2010 at 1:37 PM, Paul Lindner <li...@inuus.com> wrote:

> There isn't a closure compiler maven plugin quite yet.  Also be aware that
> the closure compiler is quite slow.  However using it has uncovered a
> number
> of issues.  See the warnings I just attached to the jira issue.
>
>
> On Tue, Jan 12, 2010 at 1:25 PM, John Hjelmstad <fa...@google.com> wrote:
>
> > Looks good. Do you have a CL for pom.xml updates as well that switches
> from
> > YUI to CC?
> >
> > -j
> >
> > On Tue, Jan 12, 2010 at 1:20 PM, Paul Lindner <pl...@linkedin.com>
> > wrote:
> >
> > > With a large number of cleanups to the jsdoc I was able to get the
> > shindig
> > > javascript compiled using the closure compiler.  Overall there's a 5%
> > > reduction in gzip'd bytes (see table below)
> > >
> > > Normally closure compiler is not used piecemeal like this.  instead
> it's
> > > used on the entirety of a script.  Doing this for content from the
> concat
> > > servlet shows a 6% reduction in gzip'd bytes:
> > >
> > >   6671 Jan 12 12:34 rpc.cc.js.gz
> > >   7116 Jan 12 12:34 rpc.opt.js.gz
> > >  26427 Jan 12 12:32 if.cc.js.gz
> > >  28171 Jan 12 12:30 if.opt.js.gz
> > >
> > >
> > > To track the cleanups to the javascript I created
> > > https://issues.apache.org/jira/browse/SHINDIG-1264  There's a bit more
> > > remaining cleanup and some remaining outstanding warnings from my
> build.
> > >
> > > REDUCTION IN GZIP BYTES
> > >
> > >  orig    yui     cc diff fname
> > >   595    104    103 1.0%
> > target/classes/features/auth-refresh/auth-refresh
> > >  2654    446    370 17.0% target/classes/features/core.auth/auth
> > >   542     59     57 3.4% target/classes/features/core.auth/auth-init
> > >  2883    590    545 7.6% target/classes/features/core.config/config
> > >  5266   2647   2285 13.7% target/classes/features/core.io/io
> > >   631    143    141 1.4% target/classes/features/core.io/taming
> > >  2726    842    797 5.3% target/classes/features/core.json/json
> > >   614    124    122 1.6% target/classes/features/core.json/taming
> > >  3063   1347   1247 7.4% target/classes/features/core.legacy/legacy
> > >  1220    303    288 5.0% target/classes/features/core.log/log
> > >   671    189    186 1.6% target/classes/features/core.log/taming
> > >  2575    777    725 6.7% target/classes/features/core.prefs/prefs
> > >   676    186    184 1.1% target/classes/features/core.prefs/taming
> > >   653    168    166 1.2% target/classes/features/core.util/taming
> > >  3544    991    926 6.6% target/classes/features/core.util/util
> > >   984    217    208 4.1%
> > > target/classes/features/dynamic-height.util/dynamic-height-util
> > >  2593    675    633 6.2%
> > > target/classes/features/dynamic-height/dynamic-height
> > >   630    144    141 2.1% target/classes/features/dynamic-height/taming
> > >  2638   1116   1054 5.6% target/classes/features/flash/flash
> > >  2092    995    929 6.6% target/classes/features/flash/taming
> > >  1020    466    472 -1.3% target/classes/features/i18n/currencycodemap
> > >  5240   1505   1451 3.6% target/classes/features/i18n/datetimeformat
> > >  1915   1313   1356 -3.3%
> target/classes/features/i18n/datetimeformattest
> > >  9641   2408   2276 5.5% target/classes/features/i18n/datetimeparse
> > >  2821   1838   1879 -2.2%
> target/classes/features/i18n/datetimeparsetest
> > >  2101    556    550 1.1% target/classes/features/i18n/formatting
> > >  5618   2514   2399 4.6% target/classes/features/i18n/numberformat
> > >  2251   1567   1586 -1.2% target/classes/features/i18n/numberformattest
> > >  2609    999    933 6.6%
> target/classes/features/minimessage/minimessage
> > >   660    175    172 1.7% target/classes/features/minimessage/taming
> > >  2010    368    350 4.9% target/classes/features/oauthpopup/oauthpopup
> > >  1695    727    723 0.6%
> > > target/classes/features/opensocial-0.6/opensocial6to7
> > >  1276    576    563 2.3%
> > > target/classes/features/opensocial-0.7/opensocial7to8
> > >   707    226    216 4.4%
> > > target/classes/features/opensocial-0.8/opensocial8to9
> > >  2184   1174   1099 6.4%
> > > target/classes/features/opensocial-base/fieldtranslations
> > >  1031    373    349 6.4%
> > > target/classes/features/opensocial-base/jsonactivity
> > >   731    191    186 2.6%
> > > target/classes/features/opensocial-base/jsonmessage
> > >   861    194    190 2.1%
> > > target/classes/features/opensocial-base/jsonmessagecollection
> > >  1186    580    548 5.5%
> > target/classes/features/opensocial-base/jsonperson
> > >  2310    660    601 8.9%
> > > target/classes/features/opensocial-data-context/datacontext
> > >  5767   2336   2216 5.1% target/classes/features/opensocial-data/data
> > >  4116   2596   2505 3.5%
> > > target/classes/features/opensocial-jsonrpc/jsonrpccontainer
> > >  3629    375    374 0.3%
> > > target/classes/features/opensocial-reference/activity
> > >  1343    290    290 0.0%
> > > target/classes/features/opensocial-reference/address
> > >  1093    195    194 0.5%
> > > target/classes/features/opensocial-reference/bodytype
> > >  1263    257    251 2.3%
> > > target/classes/features/opensocial-reference/collection
> > >  3997    673    607 9.8%
> > > target/classes/features/opensocial-reference/container
> > >  4130    798    774 3.0%
> > > target/classes/features/opensocial-reference/datarequest
> > >  1173    174    169 2.9%
> > > target/classes/features/opensocial-reference/dataresponse
> > >  1029    159    158 0.6%
> > target/classes/features/opensocial-reference/email
> > >  1726    381    384 -0.8%
> > target/classes/features/opensocial-reference/enum
> > >  1294    359    350 2.5%
> > > target/classes/features/opensocial-reference/environment
> > >  1590    264    260 1.5%
> > > target/classes/features/opensocial-reference/idspec
> > >  1318    286    278 2.8%
> > > target/classes/features/opensocial-reference/mediaitem
> > >  1893    452    452 0.0%
> > > target/classes/features/opensocial-reference/message
> > >  1213    214    212 0.9%
> > > target/classes/features/opensocial-reference/messagecollection
> > >  1096    247    245 0.8%
> > target/classes/features/opensocial-reference/name
> > >  1564    246    245 0.4%
> > > target/classes/features/opensocial-reference/navigationparameters
> > >  3858    606    592 2.3%
> > > target/classes/features/opensocial-reference/opensocial
> > >  1427    264    263 0.4%
> > > target/classes/features/opensocial-reference/organization
> > >  3389   1141   1138 0.3%
> > > target/classes/features/opensocial-reference/person
> > >  1029    157    156 0.6%
> > target/classes/features/opensocial-reference/phone
> > >  1556    333    330 0.9%
> > > target/classes/features/opensocial-reference/responseitem
> > >  1448    851    870 -2.2%
> > > target/classes/features/opensocial-reference/taming
> > >  1066    174    174 0.0%
> target/classes/features/opensocial-reference/url
> > >  4314   1595   1505 5.6%
> > target/classes/features/opensocial-templates/base
> > >  9647   3885   3672 5.5%
> > > target/classes/features/opensocial-templates/compiler
> > >  4375   1842   1714 6.9%
> > > target/classes/features/opensocial-templates/container
> > >  4153    978    905 7.5%
> > > target/classes/features/opensocial-templates/jsTemplate/jsevalcontext
> > >  9977   2767   2482 10.3%
> > > target/classes/features/opensocial-templates/jsTemplate/jstemplate
> > >  4231   1122   1060 5.5%
> > > target/classes/features/opensocial-templates/jsTemplate/util
> > >  2989   1246   1143 8.3%
> > > target/classes/features/opensocial-templates/loader
> > >  1301    308    297 3.6%
> > > target/classes/features/opensocial-templates/namespaces
> > >  2559    919    824 10.3%
> target/classes/features/opensocial-templates/os
> > >  1644    645    620 3.9%
> > > target/classes/features/opensocial-templates/template
> > >  1441    386    360 6.7%
> > target/classes/features/opensocial-templates/util
> > >  1849    447    387 13.4% target/classes/features/osapi/batch
> > >  1920    505    466 7.7%
> > target/classes/features/osapi/gadgetsrpctransport
> > >  1401    551    508 7.8% target/classes/features/osapi/jsonrpctransport
> > >  1158    388    360 7.2% target/classes/features/osapi/osapi
> > >   985    194    193 0.5% target/classes/features/osapi/peoplehelpers
> > >   989    336    328 2.4% target/classes/features/osapi/taming
> > >   981    227    210 7.5% target/classes/features/pubsub/pubsub
> > >  1415    454    412 9.3% target/classes/features/pubsub/pubsub-router
> > >   622    128    126 1.6% target/classes/features/pubsub/taming
> > >  1785    474    445 6.1% target/classes/features/rpc/fe.transport
> > >  2444    728    683 6.2% target/classes/features/rpc/ifpc.transport
> > >  4045    887    840 5.3% target/classes/features/rpc/nix.transport
> > >  6619   1420   1317 7.3% target/classes/features/rpc/rmr.transport
> > >  9270   2292   2134 6.9% target/classes/features/rpc/rpc
> > >  1610    454    429 5.5% target/classes/features/rpc/wpm.transport
> > >  1181    359    328 8.6% target/classes/features/setprefs/setprefs
> > >   723    121    120 0.8% target/classes/features/settitle/settitle
> > >   606    116    114 1.7% target/classes/features/settitle/taming
> > >  1226    253    242 4.3% target/classes/features/skins/skins
> > >   608    117    115 1.7% target/classes/features/skins/taming
> > >  5496   2640   2491 5.6% target/classes/features/tabs/tabs
> > >   716    223    222 0.4% target/classes/features/tabs/taming
> > >   705    215    212 1.4% target/classes/features/views/taming
> > >  3653   1643   1550 5.7% target/classes/features/views/views
> > >  1867    755    728 3.6% target/classes/features/xmlutil/xmlutil
> > > ---------------------------------------------------
> > > 238629  75921    728 5.1%
> > > YUI Better   : 6 (131)
> > > CC Better    : 92 (4017)
> > >
> >
>

Re: experiments with closure compiler

Posted by Paul Lindner <li...@inuus.com>.
There isn't a closure compiler maven plugin quite yet.  Also be aware that
the closure compiler is quite slow.  However using it has uncovered a number
of issues.  See the warnings I just attached to the jira issue.


On Tue, Jan 12, 2010 at 1:25 PM, John Hjelmstad <fa...@google.com> wrote:

> Looks good. Do you have a CL for pom.xml updates as well that switches from
> YUI to CC?
>
> -j
>
> On Tue, Jan 12, 2010 at 1:20 PM, Paul Lindner <pl...@linkedin.com>
> wrote:
>
> > With a large number of cleanups to the jsdoc I was able to get the
> shindig
> > javascript compiled using the closure compiler.  Overall there's a 5%
> > reduction in gzip'd bytes (see table below)
> >
> > Normally closure compiler is not used piecemeal like this.  instead it's
> > used on the entirety of a script.  Doing this for content from the concat
> > servlet shows a 6% reduction in gzip'd bytes:
> >
> >   6671 Jan 12 12:34 rpc.cc.js.gz
> >   7116 Jan 12 12:34 rpc.opt.js.gz
> >  26427 Jan 12 12:32 if.cc.js.gz
> >  28171 Jan 12 12:30 if.opt.js.gz
> >
> >
> > To track the cleanups to the javascript I created
> > https://issues.apache.org/jira/browse/SHINDIG-1264  There's a bit more
> > remaining cleanup and some remaining outstanding warnings from my build.
> >
> > REDUCTION IN GZIP BYTES
> >
> >  orig    yui     cc diff fname
> >   595    104    103 1.0%
> target/classes/features/auth-refresh/auth-refresh
> >  2654    446    370 17.0% target/classes/features/core.auth/auth
> >   542     59     57 3.4% target/classes/features/core.auth/auth-init
> >  2883    590    545 7.6% target/classes/features/core.config/config
> >  5266   2647   2285 13.7% target/classes/features/core.io/io
> >   631    143    141 1.4% target/classes/features/core.io/taming
> >  2726    842    797 5.3% target/classes/features/core.json/json
> >   614    124    122 1.6% target/classes/features/core.json/taming
> >  3063   1347   1247 7.4% target/classes/features/core.legacy/legacy
> >  1220    303    288 5.0% target/classes/features/core.log/log
> >   671    189    186 1.6% target/classes/features/core.log/taming
> >  2575    777    725 6.7% target/classes/features/core.prefs/prefs
> >   676    186    184 1.1% target/classes/features/core.prefs/taming
> >   653    168    166 1.2% target/classes/features/core.util/taming
> >  3544    991    926 6.6% target/classes/features/core.util/util
> >   984    217    208 4.1%
> > target/classes/features/dynamic-height.util/dynamic-height-util
> >  2593    675    633 6.2%
> > target/classes/features/dynamic-height/dynamic-height
> >   630    144    141 2.1% target/classes/features/dynamic-height/taming
> >  2638   1116   1054 5.6% target/classes/features/flash/flash
> >  2092    995    929 6.6% target/classes/features/flash/taming
> >  1020    466    472 -1.3% target/classes/features/i18n/currencycodemap
> >  5240   1505   1451 3.6% target/classes/features/i18n/datetimeformat
> >  1915   1313   1356 -3.3% target/classes/features/i18n/datetimeformattest
> >  9641   2408   2276 5.5% target/classes/features/i18n/datetimeparse
> >  2821   1838   1879 -2.2% target/classes/features/i18n/datetimeparsetest
> >  2101    556    550 1.1% target/classes/features/i18n/formatting
> >  5618   2514   2399 4.6% target/classes/features/i18n/numberformat
> >  2251   1567   1586 -1.2% target/classes/features/i18n/numberformattest
> >  2609    999    933 6.6% target/classes/features/minimessage/minimessage
> >   660    175    172 1.7% target/classes/features/minimessage/taming
> >  2010    368    350 4.9% target/classes/features/oauthpopup/oauthpopup
> >  1695    727    723 0.6%
> > target/classes/features/opensocial-0.6/opensocial6to7
> >  1276    576    563 2.3%
> > target/classes/features/opensocial-0.7/opensocial7to8
> >   707    226    216 4.4%
> > target/classes/features/opensocial-0.8/opensocial8to9
> >  2184   1174   1099 6.4%
> > target/classes/features/opensocial-base/fieldtranslations
> >  1031    373    349 6.4%
> > target/classes/features/opensocial-base/jsonactivity
> >   731    191    186 2.6%
> > target/classes/features/opensocial-base/jsonmessage
> >   861    194    190 2.1%
> > target/classes/features/opensocial-base/jsonmessagecollection
> >  1186    580    548 5.5%
> target/classes/features/opensocial-base/jsonperson
> >  2310    660    601 8.9%
> > target/classes/features/opensocial-data-context/datacontext
> >  5767   2336   2216 5.1% target/classes/features/opensocial-data/data
> >  4116   2596   2505 3.5%
> > target/classes/features/opensocial-jsonrpc/jsonrpccontainer
> >  3629    375    374 0.3%
> > target/classes/features/opensocial-reference/activity
> >  1343    290    290 0.0%
> > target/classes/features/opensocial-reference/address
> >  1093    195    194 0.5%
> > target/classes/features/opensocial-reference/bodytype
> >  1263    257    251 2.3%
> > target/classes/features/opensocial-reference/collection
> >  3997    673    607 9.8%
> > target/classes/features/opensocial-reference/container
> >  4130    798    774 3.0%
> > target/classes/features/opensocial-reference/datarequest
> >  1173    174    169 2.9%
> > target/classes/features/opensocial-reference/dataresponse
> >  1029    159    158 0.6%
> target/classes/features/opensocial-reference/email
> >  1726    381    384 -0.8%
> target/classes/features/opensocial-reference/enum
> >  1294    359    350 2.5%
> > target/classes/features/opensocial-reference/environment
> >  1590    264    260 1.5%
> > target/classes/features/opensocial-reference/idspec
> >  1318    286    278 2.8%
> > target/classes/features/opensocial-reference/mediaitem
> >  1893    452    452 0.0%
> > target/classes/features/opensocial-reference/message
> >  1213    214    212 0.9%
> > target/classes/features/opensocial-reference/messagecollection
> >  1096    247    245 0.8%
> target/classes/features/opensocial-reference/name
> >  1564    246    245 0.4%
> > target/classes/features/opensocial-reference/navigationparameters
> >  3858    606    592 2.3%
> > target/classes/features/opensocial-reference/opensocial
> >  1427    264    263 0.4%
> > target/classes/features/opensocial-reference/organization
> >  3389   1141   1138 0.3%
> > target/classes/features/opensocial-reference/person
> >  1029    157    156 0.6%
> target/classes/features/opensocial-reference/phone
> >  1556    333    330 0.9%
> > target/classes/features/opensocial-reference/responseitem
> >  1448    851    870 -2.2%
> > target/classes/features/opensocial-reference/taming
> >  1066    174    174 0.0% target/classes/features/opensocial-reference/url
> >  4314   1595   1505 5.6%
> target/classes/features/opensocial-templates/base
> >  9647   3885   3672 5.5%
> > target/classes/features/opensocial-templates/compiler
> >  4375   1842   1714 6.9%
> > target/classes/features/opensocial-templates/container
> >  4153    978    905 7.5%
> > target/classes/features/opensocial-templates/jsTemplate/jsevalcontext
> >  9977   2767   2482 10.3%
> > target/classes/features/opensocial-templates/jsTemplate/jstemplate
> >  4231   1122   1060 5.5%
> > target/classes/features/opensocial-templates/jsTemplate/util
> >  2989   1246   1143 8.3%
> > target/classes/features/opensocial-templates/loader
> >  1301    308    297 3.6%
> > target/classes/features/opensocial-templates/namespaces
> >  2559    919    824 10.3% target/classes/features/opensocial-templates/os
> >  1644    645    620 3.9%
> > target/classes/features/opensocial-templates/template
> >  1441    386    360 6.7%
> target/classes/features/opensocial-templates/util
> >  1849    447    387 13.4% target/classes/features/osapi/batch
> >  1920    505    466 7.7%
> target/classes/features/osapi/gadgetsrpctransport
> >  1401    551    508 7.8% target/classes/features/osapi/jsonrpctransport
> >  1158    388    360 7.2% target/classes/features/osapi/osapi
> >   985    194    193 0.5% target/classes/features/osapi/peoplehelpers
> >   989    336    328 2.4% target/classes/features/osapi/taming
> >   981    227    210 7.5% target/classes/features/pubsub/pubsub
> >  1415    454    412 9.3% target/classes/features/pubsub/pubsub-router
> >   622    128    126 1.6% target/classes/features/pubsub/taming
> >  1785    474    445 6.1% target/classes/features/rpc/fe.transport
> >  2444    728    683 6.2% target/classes/features/rpc/ifpc.transport
> >  4045    887    840 5.3% target/classes/features/rpc/nix.transport
> >  6619   1420   1317 7.3% target/classes/features/rpc/rmr.transport
> >  9270   2292   2134 6.9% target/classes/features/rpc/rpc
> >  1610    454    429 5.5% target/classes/features/rpc/wpm.transport
> >  1181    359    328 8.6% target/classes/features/setprefs/setprefs
> >   723    121    120 0.8% target/classes/features/settitle/settitle
> >   606    116    114 1.7% target/classes/features/settitle/taming
> >  1226    253    242 4.3% target/classes/features/skins/skins
> >   608    117    115 1.7% target/classes/features/skins/taming
> >  5496   2640   2491 5.6% target/classes/features/tabs/tabs
> >   716    223    222 0.4% target/classes/features/tabs/taming
> >   705    215    212 1.4% target/classes/features/views/taming
> >  3653   1643   1550 5.7% target/classes/features/views/views
> >  1867    755    728 3.6% target/classes/features/xmlutil/xmlutil
> > ---------------------------------------------------
> > 238629  75921    728 5.1%
> > YUI Better   : 6 (131)
> > CC Better    : 92 (4017)
> >
>

Re: experiments with closure compiler

Posted by John Hjelmstad <fa...@google.com>.
Looks good. Do you have a CL for pom.xml updates as well that switches from
YUI to CC?

-j

On Tue, Jan 12, 2010 at 1:20 PM, Paul Lindner <pl...@linkedin.com> wrote:

> With a large number of cleanups to the jsdoc I was able to get the shindig
> javascript compiled using the closure compiler.  Overall there's a 5%
> reduction in gzip'd bytes (see table below)
>
> Normally closure compiler is not used piecemeal like this.  instead it's
> used on the entirety of a script.  Doing this for content from the concat
> servlet shows a 6% reduction in gzip'd bytes:
>
>   6671 Jan 12 12:34 rpc.cc.js.gz
>   7116 Jan 12 12:34 rpc.opt.js.gz
>  26427 Jan 12 12:32 if.cc.js.gz
>  28171 Jan 12 12:30 if.opt.js.gz
>
>
> To track the cleanups to the javascript I created
> https://issues.apache.org/jira/browse/SHINDIG-1264  There's a bit more
> remaining cleanup and some remaining outstanding warnings from my build.
>
> REDUCTION IN GZIP BYTES
>
>  orig    yui     cc diff fname
>   595    104    103 1.0% target/classes/features/auth-refresh/auth-refresh
>  2654    446    370 17.0% target/classes/features/core.auth/auth
>   542     59     57 3.4% target/classes/features/core.auth/auth-init
>  2883    590    545 7.6% target/classes/features/core.config/config
>  5266   2647   2285 13.7% target/classes/features/core.io/io
>   631    143    141 1.4% target/classes/features/core.io/taming
>  2726    842    797 5.3% target/classes/features/core.json/json
>   614    124    122 1.6% target/classes/features/core.json/taming
>  3063   1347   1247 7.4% target/classes/features/core.legacy/legacy
>  1220    303    288 5.0% target/classes/features/core.log/log
>   671    189    186 1.6% target/classes/features/core.log/taming
>  2575    777    725 6.7% target/classes/features/core.prefs/prefs
>   676    186    184 1.1% target/classes/features/core.prefs/taming
>   653    168    166 1.2% target/classes/features/core.util/taming
>  3544    991    926 6.6% target/classes/features/core.util/util
>   984    217    208 4.1%
> target/classes/features/dynamic-height.util/dynamic-height-util
>  2593    675    633 6.2%
> target/classes/features/dynamic-height/dynamic-height
>   630    144    141 2.1% target/classes/features/dynamic-height/taming
>  2638   1116   1054 5.6% target/classes/features/flash/flash
>  2092    995    929 6.6% target/classes/features/flash/taming
>  1020    466    472 -1.3% target/classes/features/i18n/currencycodemap
>  5240   1505   1451 3.6% target/classes/features/i18n/datetimeformat
>  1915   1313   1356 -3.3% target/classes/features/i18n/datetimeformattest
>  9641   2408   2276 5.5% target/classes/features/i18n/datetimeparse
>  2821   1838   1879 -2.2% target/classes/features/i18n/datetimeparsetest
>  2101    556    550 1.1% target/classes/features/i18n/formatting
>  5618   2514   2399 4.6% target/classes/features/i18n/numberformat
>  2251   1567   1586 -1.2% target/classes/features/i18n/numberformattest
>  2609    999    933 6.6% target/classes/features/minimessage/minimessage
>   660    175    172 1.7% target/classes/features/minimessage/taming
>  2010    368    350 4.9% target/classes/features/oauthpopup/oauthpopup
>  1695    727    723 0.6%
> target/classes/features/opensocial-0.6/opensocial6to7
>  1276    576    563 2.3%
> target/classes/features/opensocial-0.7/opensocial7to8
>   707    226    216 4.4%
> target/classes/features/opensocial-0.8/opensocial8to9
>  2184   1174   1099 6.4%
> target/classes/features/opensocial-base/fieldtranslations
>  1031    373    349 6.4%
> target/classes/features/opensocial-base/jsonactivity
>   731    191    186 2.6%
> target/classes/features/opensocial-base/jsonmessage
>   861    194    190 2.1%
> target/classes/features/opensocial-base/jsonmessagecollection
>  1186    580    548 5.5% target/classes/features/opensocial-base/jsonperson
>  2310    660    601 8.9%
> target/classes/features/opensocial-data-context/datacontext
>  5767   2336   2216 5.1% target/classes/features/opensocial-data/data
>  4116   2596   2505 3.5%
> target/classes/features/opensocial-jsonrpc/jsonrpccontainer
>  3629    375    374 0.3%
> target/classes/features/opensocial-reference/activity
>  1343    290    290 0.0%
> target/classes/features/opensocial-reference/address
>  1093    195    194 0.5%
> target/classes/features/opensocial-reference/bodytype
>  1263    257    251 2.3%
> target/classes/features/opensocial-reference/collection
>  3997    673    607 9.8%
> target/classes/features/opensocial-reference/container
>  4130    798    774 3.0%
> target/classes/features/opensocial-reference/datarequest
>  1173    174    169 2.9%
> target/classes/features/opensocial-reference/dataresponse
>  1029    159    158 0.6% target/classes/features/opensocial-reference/email
>  1726    381    384 -0.8% target/classes/features/opensocial-reference/enum
>  1294    359    350 2.5%
> target/classes/features/opensocial-reference/environment
>  1590    264    260 1.5%
> target/classes/features/opensocial-reference/idspec
>  1318    286    278 2.8%
> target/classes/features/opensocial-reference/mediaitem
>  1893    452    452 0.0%
> target/classes/features/opensocial-reference/message
>  1213    214    212 0.9%
> target/classes/features/opensocial-reference/messagecollection
>  1096    247    245 0.8% target/classes/features/opensocial-reference/name
>  1564    246    245 0.4%
> target/classes/features/opensocial-reference/navigationparameters
>  3858    606    592 2.3%
> target/classes/features/opensocial-reference/opensocial
>  1427    264    263 0.4%
> target/classes/features/opensocial-reference/organization
>  3389   1141   1138 0.3%
> target/classes/features/opensocial-reference/person
>  1029    157    156 0.6% target/classes/features/opensocial-reference/phone
>  1556    333    330 0.9%
> target/classes/features/opensocial-reference/responseitem
>  1448    851    870 -2.2%
> target/classes/features/opensocial-reference/taming
>  1066    174    174 0.0% target/classes/features/opensocial-reference/url
>  4314   1595   1505 5.6% target/classes/features/opensocial-templates/base
>  9647   3885   3672 5.5%
> target/classes/features/opensocial-templates/compiler
>  4375   1842   1714 6.9%
> target/classes/features/opensocial-templates/container
>  4153    978    905 7.5%
> target/classes/features/opensocial-templates/jsTemplate/jsevalcontext
>  9977   2767   2482 10.3%
> target/classes/features/opensocial-templates/jsTemplate/jstemplate
>  4231   1122   1060 5.5%
> target/classes/features/opensocial-templates/jsTemplate/util
>  2989   1246   1143 8.3%
> target/classes/features/opensocial-templates/loader
>  1301    308    297 3.6%
> target/classes/features/opensocial-templates/namespaces
>  2559    919    824 10.3% target/classes/features/opensocial-templates/os
>  1644    645    620 3.9%
> target/classes/features/opensocial-templates/template
>  1441    386    360 6.7% target/classes/features/opensocial-templates/util
>  1849    447    387 13.4% target/classes/features/osapi/batch
>  1920    505    466 7.7% target/classes/features/osapi/gadgetsrpctransport
>  1401    551    508 7.8% target/classes/features/osapi/jsonrpctransport
>  1158    388    360 7.2% target/classes/features/osapi/osapi
>   985    194    193 0.5% target/classes/features/osapi/peoplehelpers
>   989    336    328 2.4% target/classes/features/osapi/taming
>   981    227    210 7.5% target/classes/features/pubsub/pubsub
>  1415    454    412 9.3% target/classes/features/pubsub/pubsub-router
>   622    128    126 1.6% target/classes/features/pubsub/taming
>  1785    474    445 6.1% target/classes/features/rpc/fe.transport
>  2444    728    683 6.2% target/classes/features/rpc/ifpc.transport
>  4045    887    840 5.3% target/classes/features/rpc/nix.transport
>  6619   1420   1317 7.3% target/classes/features/rpc/rmr.transport
>  9270   2292   2134 6.9% target/classes/features/rpc/rpc
>  1610    454    429 5.5% target/classes/features/rpc/wpm.transport
>  1181    359    328 8.6% target/classes/features/setprefs/setprefs
>   723    121    120 0.8% target/classes/features/settitle/settitle
>   606    116    114 1.7% target/classes/features/settitle/taming
>  1226    253    242 4.3% target/classes/features/skins/skins
>   608    117    115 1.7% target/classes/features/skins/taming
>  5496   2640   2491 5.6% target/classes/features/tabs/tabs
>   716    223    222 0.4% target/classes/features/tabs/taming
>   705    215    212 1.4% target/classes/features/views/taming
>  3653   1643   1550 5.7% target/classes/features/views/views
>  1867    755    728 3.6% target/classes/features/xmlutil/xmlutil
> ---------------------------------------------------
> 238629  75921    728 5.1%
> YUI Better   : 6 (131)
> CC Better    : 92 (4017)
>