sockjs-client icon indicating copy to clipboard operation
sockjs-client copied to clipboard

Closure Compiler compatibility

Open macinjosh32 opened this issue 12 years ago • 4 comments

Since keeping a small JS footprint is critical for our application (see #178), it would be great to be able to compile SockJS via Google Closure Compiler with ADVANCED_OPTIMIZATIONS. Is compatibility with GCC on the v1.x roadmap?

macinjosh32 avatar Jun 09 '14 15:06 macinjosh32

This isn't something I had considered yet. I can see what kind of filesize difference it makes. Even if we don't use that for compilation by default, I don't see any reason you couldn't do it yourself from the non-minified version.

brycekahle avatar Jun 09 '14 15:06 brycekahle

It looks like ADVANCED_OPTIMIZATIONS reduces the file size of the minified sockjs-0.3 from 29K to 25K, or a savings of roughly 17%. Not huge overall, but it makes a big difference for us. A.O. also tends to improve application speed by inlining stuff and removing dead code.

Since A.O. obfuscates unquoted property names, the main change needed for A.O. compatibility is to quote property names serialized over the wire. In detectProtocols, for example, info.websocket should be written as info['websocket']. Browsing through the code, I think the tweaks needed will be few and easy. If I have a few free minutes, I'll make them and submit a PR.

macinjosh32 avatar Jun 09 '14 17:06 macinjosh32

We want ADVANCED_OPTIMIZATIONS compatibility too...

chemist777 avatar Oct 14 '14 16:10 chemist777

This issue has been inactive for 30 days. It will be in closed in 5 days without any new activity.

github-actions[bot] avatar Aug 03 '20 00:08 github-actions[bot]