this blog post gave me new ways of speeding up page loads.
the learning is that js file requests are blocking. so either reduce the number of js or load them dynamically.
we tried to apply these into our work. combining js into one has some practical difficulties.
developers are used to working with their respective files. multiple checkout of the same file leads to other issues and so on. we did this sort of hack and it works fine.
0. we use tomcat and jsp in our web app. the explanation is relevant in this context.
1. configure tomcat to treat myjs (it could be anything) as a jsp extension ie., it would parse files
of myjs extension.
2. in the alljs.myjs file have as many . These are the js files that need to be combined.
3. the include directive in jsp does a textual copy of files. thus all the required jsps are combined into
4. the jsp or html page where alljs.myjs is required is referred as
at development time.
6. by using gzip and minifying the jses, the performance has improved much.
The drawback with this approach is that the myjs file is not cached by the browser the way .js files are. This could be circumvented by some setting cache-control, Expires etc on resources of *.myjs type in Apache. But we are yet to try this. would update this post after we find something.