Page 1 of 4 123 ... LastLast
Results 1 to 10 of 31

Thread: Googles Closure Compiler

  1. #1
    Sencha User
    Join Date
    Dec 2008
    Location
    Mainz
    Posts
    241
    Vote Rating
    1
      0  

    Default Googles Closure Compiler

    Just for those of you who doesn't follow Ajaxian

    Google released an intresting tool called Closure Compiler which takes compression to a new level...

    Since the ext-all.js file was to big for the online service I wasn't able to test it yet but I think the Extjs team may should give it a try...

    Btw. Google also released a JS template engine and its own Lib... Definitely inluding some nice ideas!

    The article on Ajaxian:

    http://ajaxian.com/archives/google-r...he-js-geniuses

    And the Google - Code link:

    http://code.google.com/intl/de/closure/


    Any thoughts?

  2. #2
    Sencha - Community Support Team Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,246
    Vote Rating
    122
      0  

    Default

    I ran ext-all-debug.js through the command line version and the result was 20kb smaller than with YUICompressor!

    I also tried advanced optimizations, but it crashed on the missing 'batch' variable in Ext.DomQuery.

    It also complains a lot about invalid JSDoc (which is correct, because it's ExtDoc). Unfortunately there is no option to disable JSDoc error checking.

  3. #3
    Sencha Premium User mankz's Avatar
    Join Date
    Nov 2007
    Location
    Stockholm, Sweden
    Posts
    3,124
    Vote Rating
    188
      0  

    Default

    @condor: would be interesting to see what it could do to ext-all.js. Any way we could get past the missing batch variable issue?

  4. #4
    Sencha - Community Support Team Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,246
    Vote Rating
    122
      0  

    Default

    The compiler works when using SIMPLE_OPTIMIZATION level.
    Code:
    "%JAVA_HOME%\bin\java" -jar compiler.jar --compilation_level SIMPLE_OPTIMIZATIONS --js ext-base-debug.js --js_output_file ext-base.js
    But it crashes with ADVANCED_OPTIMIZATIONS level:
    Code:
    "%JAVA_HOME%\bin\java" -jar compiler.jar --compilation_level ADVANCED_OPTIMIZATIONS --js ext-base-debug.js --js_output_file ext-base.js
    ps. Advanced mode isn't useful for compressing a javascript library anyway. You should only use it to compress a complete application.

  5. #5
    Sencha User
    Join Date
    Dec 2008
    Location
    Mainz
    Posts
    241
    Vote Rating
    1
      0  

    Default

    I am aware of that... But what i am actually wondering about is if the whole Extjs aplication still works if i compile it.

    The compile will remove unused functions and rename variables for compression, I wonder if it takes care of the extjs extending structure...

  6. #6
    Sencha - Community Support Team Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,246
    Vote Rating
    122
      0  

    Default

    That is always the problem with compressors. How do you verify that the compressed library still works as expected.
    You would need to have unit tests that cover every aspect of the library (and that's something that Ext is still missing).

    So far the library that I compressed on 'simple' level looks good.

  7. #7
    Ext User deanna's Avatar
    Join Date
    Aug 2007
    Location
    Alabama
    Posts
    306
    Vote Rating
    0
      0  

    Default

    Closures seems to be more than just the compiler. There is a performance addon for firefox and a pretty extensive set of widgets with a dependency loader. Some of the widgets have an overlap with extjs, but there are others in there that are useful: including a gears widget, some graphics/canvas widgets, spell checking, and various other useful things.

    http://closure-library.googlecode.co...ocs/index.html

    Samples
    http://closure-library.googlecode.co...re/goog/demos/

  8. #8
    Ext User
    Join Date
    Jul 2007
    Posts
    33
    Vote Rating
    0
      0  

    Default

    I also tried to run it and got over 100 errors on the simple optimization level, mostly related to variables it can't see as defined, mostly clearInterval, setInterval, and setTimeout (???).

  9. #9
    Ext User
    Join Date
    Jul 2007
    Posts
    33
    Vote Rating
    0
      0  

    Default

    Quote Originally Posted by Condor View Post
    I ran ext-all-debug.js through the command line version and the result was 20kb smaller than with YUICompressor!

    I also tried advanced optimizations, but it crashed on the missing 'batch' variable in Ext.DomQuery.

    It also complains a lot about invalid JSDoc (which is correct, because it's ExtDoc). Unfortunately there is no option to disable JSDoc error checking.
    What command line params did you use? I could not get it to work with anything but whitespace only on ext-all-debug.js.

  10. #10
    Sencha - Community Support Team Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,246
    Vote Rating
    122
      0  

    Default

    I didn't use anything special:
    Code:
    "%JAVA_HOME%\bin\java" -jar compiler.jar --compilation_level SIMPLE_OPTIMIZATIONS --js ext-all-debug.js --js_output_file ext-all.js
    (gives a lot of warnings about invalid JSDoc, but does compile)

Page 1 of 4 123 ... LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •