way to minimize time to load javascript?

Hi All,

I have created javascript component which depends on ext-all.js library.
This ext-all.js is huge file aroung 1.5MB.
When we load the component it takes long time to render, do we have any way to minimize this time in vaadin?
Something like adding library to vaadinBootstrap.js will work?

-Thanks

Enable GZIP packing in your servlet container.

I have enabled gzip but not making any difference

Use firebug end check that data the browser receives is acually gziped.
NOTE that depending on the server you have to cofigure what files it should zip and also configure a min size for content to zip.

Ensure that the large content .css , .js is sent to the browser with :
Content-Encoding : gzip

As a reference , The changes I had to make on Glassfish 3.x Network Listeners :
“Compression” ==> on
“Compressible Mime Types” ==> text/html,text/xml,text/plain,text/css,text/javascript
“Compression Minimum Size” ==> 512

Note the MimeTypes text/css,text/javascript , these are the important files you want to compress…

Using asadmin you can change it with:



${GLASSFISH_HOME}/bin/asadmin set server-config.network-config.network-listeners.network-listener.http-listener-1.property.compression=on
${GLASSFISH_HOME}/bin/asadmin set server-config.network-config.network-listeners.network-listener.http-listener-1.property.minCompressionSize=512
${GLASSFISH_HOME}/bin/asadmin set server-config.network-config.network-listeners.network-listener.http-listener-1.property.compressableMimeType="text/html,text/xml,text/javascript,text/css,text/plain"


${GLASSFISH_HOME}/bin/asadmin set server-config.network-config.network-listeners.network-listener.http-listener-2.property.compression=on
${GLASSFISH_HOME}/bin/asadmin set server-config.network-config.network-listeners.network-listener.http-listener-2.property.minCompressionSize=512
${GLASSFISH_HOME}/bin/asadmin set server-config.network-config.network-listeners.network-listener.http-listener-2.property.compressableMimeType="text/html,text/xml,text/javascript,text/css,text/plain"

EDIT: you might need to restart the servlet container for these settings to take effect

Instead of including lots of jars (ehcache or jetty with the gzip filters), I simply enabled the compression in Tomcat, as mentioned here:
https://vaadin.com/forum#!/thread/9994800

Yet, to enable compression one needs to disable the NIO sendfile which may decrease performance. Also, recompressing the same files over and over again seems like a waste of CPU cycles to me. Would you perhaps agree that for such js scripts (included in resources, referenced by @JavaScript), Vaadin could employ the same strategy as it does for CSS and widgetset (that is, if there is a .gz file, serve that)? If yes, please let me know and I’ll create a feature request at the Vaadin tracker.