Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 327453 - Compress all JavaScript at runtime
Summary: Compress all JavaScript at runtime
Status: RESOLVED WONTFIX
Alias: None
Product: RAP
Classification: RT
Component: RWT (show other bugs)
Version: 1.4   Edit
Hardware: PC Linux
: P3 enhancement with 1 vote (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard: plan-version=1.5 plan-theme=developme...
Keywords:
Depends on:
Blocks: 338647
  Show dependency tree
 
Reported: 2010-10-11 10:36 EDT by Ralf Sternberg CLA
Modified: 2012-11-03 13:51 EDT (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ralf Sternberg CLA 2010-10-11 10:36:05 EDT
If we could improve our Javascript compression, we could consider compressing all Javascript at runtime. To do so, we should consider integrating an existing compressor such as the YUI compressor http://yuilibrary.com/projects/yuicompressor/ or the Closure Compiler http://code.google.com/closure/compiler/.

Expected benefits:
* the additional step of creating pre-compiled Javascript files using a third-party tool would become obsolete
* custom Javascript code would also benefit from the improved compression
* standard and debug variant could not differ, which can now happen by mistake

Possible problems:
* the compression might slow down the initial start time, we need to evaluate that
Comment 1 Benjamin Muskalla CLA 2010-10-11 10:55:10 EDT
You should be careful with approaches like the closure compiler. The last time I checked it, it did the same thing as GWT - dead code elimination. Without a client-side protocol handler, this can be problematic as either the code that is called from the LCAs isn't there anymore or has another name.
Comment 2 Tim Buschtoens CLA 2010-10-11 10:58:21 EDT
This would also enable us (in theory) to create browser- or application-specific client-code, decresing the size of javascript that needs to be transported and parsed.
Comment 3 Ralf Sternberg CLA 2010-10-11 17:34:52 EDT
(In reply to comment #1)
> You should be careful with approaches like the closure compiler. The last time I
> checked it, it did the same thing as GWT - dead code elimination. Without a
> client-side protocol handler, this can be problematic as either the code that is
> called from the LCAs isn't there anymore or has another name.

If this code elimination is not optional, it would of course disqualify the Closure Compiler. Even with a protocol handler this would exclude any custom widgets.
But the YUI compressor seems to do a very good job (see bug 327451)!
Comment 4 Ralf Sternberg CLA 2011-02-05 04:48:12 EST
With the approval of CQ 4536, the subset needed from the YUI Compressor can now be checked into our CVS.
Comment 5 Ivan Furnadjiev CLA 2011-03-31 06:24:18 EDT
YUI Compressor is in CVS. client.js is not needed anymore as YUI Compressor compresses the javascript files at runtime in "standard" mode. In "debug" mode the javascript files are delivered uncompressed.
Comment 6 Rüdiger Herrmann CLA 2011-03-31 06:57:37 EDT
Does this change affect the startup time of RAP?
Comment 7 Ivan Furnadjiev CLA 2011-03-31 07:24:07 EDT
We do the measurement before the actual integration and the results are the following - measurement is done in DisplayLCA#writeLibraries:
1. with client.js - average time of 10 measurements is 1948 ms
2. with YIU compression - average time of 10 measurements is 2314 ms
We loose ~350ms from the startup time witch is about 15%.
Comment 8 Ivan Furnadjiev CLA 2011-03-31 07:34:09 EDT
I did the measurements again with the current CVS HEAD - measurement is done in DisplayLCA#registerResources. The average time needed for QooxdooResourcesUtil.registerResources(); is 2250ms.
Comment 9 Ivan Furnadjiev CLA 2011-03-31 08:10:04 EDT
I reverted the last changes as my last measurements of the startup time show different result than before.
Comment 10 Austin Riddle CLA 2012-02-29 12:46:07 EST
Is there anything we can do to make this a reality for 1.5?
Comment 11 Ivan Furnadjiev CLA 2012-02-29 13:03:11 EST
We have it in our list for M7.
Comment 12 Ralf Sternberg CLA 2012-11-03 13:51:22 EDT
Compressing all JavaScript at runtime would delay the startup by roughly 2 seconds. While this is certainly acceptable at deployment time, it would further impede the development-deploy-test cycle. Therefore we agreed not to do this at the moment.

I've opened bug 393496 to move the clientbuilder into the RAP repository. This will make it easier for others to re-built the client.