I have built a static site generator service and now I am trying to get it faster. I have built it in Javascript. I managed to concatenate and minify all angular.js scripts except for one. I also have minified all css and tried to make all images smaller.
Still it looks as if the main problem is the external javascript CDN which has up to 5 sec DNS lookup time and has a size of aprox 2 Mb. I use Cloudflare and try to cache all on the first page.
What would the best aproach be? Collect all external scripts and concatenate them into one file and server them from my server?
The long DNS times are probably caused by the browser being busy executing some js (the CPU is pretty much pegged). Try turning on a dev tools timeline capture in teh chrome tab of the advanced settings which will tell you what JS is running and how long it is taking.
It’s not so much the number of files but the actual execution of the code in them. Combining/merging won’t change that. A dev tools timeline will help point out the really painful ones in case there’s a pathological problem.
Ok, not much I can do if it is a problem with an external script that my service is dependent on. If it’s really bad I will have to investigate it thou.
Thanks for your insight!
[hr]
I have a dude down in Cambodia on a slow connection with a Android smartphone which managed to use the service. So it appears to work.
I really think that you should at least download the external javascripts files (for example angularjs modules) and use a grunt job to combine/bundle all of them in one. The formation that I’m using is using bower for maintaining external javascript dependencies and grunt to combine all of them into one js file. It will greatly improve your website’s performance