[OpenLayers-Trac] [OpenLayers] #2958: Compressed code "OpenLayers.js" can be reduced 6.8% (58k)

OpenLayers trac-20090302 at openlayers.org
Thu Dec 2 14:08:32 EST 2010


#2958: Compressed code "OpenLayers.js" can be reduced 6.8% (58k)
-------------------------+--------------------------------------------------
 Reporter:  jorix        |       Owner:              
     Type:  feature      |      Status:  new         
 Priority:  minor        |   Milestone:  2.11 Release
Component:  general      |     Version:  2.10        
 Keywords:  build tools  |       State:              
-------------------------+--------------------------------------------------
 The patch proposes to change (with a python process) the public name most
 used by 3-letter names, and assign long names at the end.

 At first I thought to use local variables, like this:


 {{{
 var OpenLayers;
 (Function () {
    var O$, O$0, O$1 ... O$z;
    O$ = {version_number: ....
    ... OpenLayers code with short names ...
    OpenLayers = O$;
    ... other assignments ...
 })();
 }}}

 But the local variable has a 50% impart on load time in FF and Safari.

 The proposed patch uses the public variable with the prefix O$. The patch
 proposes to change 64 names has also been studied change for 32 or 16
 names, see results.

 Remains to be done (the actual patch changes the OpenLayers names are not
 the beginning of a literal), but the patch can evaluate the performance
 and error tests.

 All tests with IE, FF, Chrome and Safari are working properly with
 compressed code (only four tests required adaptation, and those that fail
 they give the same results as normal code [BaseTypes.html in Chome and
 Format/OWSContext/v0_3_1.html & Projection.html in IE using SVN 10907])

 NOTE: It has been studied for use with DojoShrinkSafe and Closure
 Compiler.

 See the results of compression and performance in:
 https://spreadsheets.google.com/ccc?key=0AlBDeuHNzb3WdDFmd3ZRNkZhYTlla2lOT3FqUTFTSXc&hl=en#gid=0

  See other material in:
 https://docs.google.com/leaf?id=0B1BDeuHNzb3WMGM1ZGE3YmYtMDJkYS00N2VkLTk3NDctMDk5YWIwNjZkYzUy&hl=en

-- 
Ticket URL: <http://trac.openlayers.org/ticket/2958>
OpenLayers <http://openlayers.org/>
A free AJAX map viewer


More information about the Trac mailing list