Ticket #2958 (closed feature: wontfix)
Compressed code "OpenLayers.js" can be reduced 6.8% (58k)
| Reported by: | jorix | Owned by: | |
|---|---|---|---|
| Priority: | minor | Milestone: | 2.11 Release |
| Component: | general | Version: | 2.10 |
| Keywords: | Cc: | ||
| State: |
Description
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

