I'm working on some miscellaneous things to speed up my site, the next of which is combining my various javascripts into one file. I'm not sure if the result could slow down the server since it makes it work harder though, can someone give me some input?
Currently I have at least 3 separate js files (living on my domain) that are included on every page, which aren't minified. There may also be one or two other js files pulled in from my domain depending on the page. FYI I also load jquery and jquery ui from the google domain
So I have two goals: first, decrease the overall number of http requests, and second, decrease the overall size of the downloaded files.
I found a handy PHP script someone had written, which outputs the appropriate headers and uses readfile() to read in the various javascripts. So this solves my first goal. To solve my second goal I'm thinking about using an output buffer in the script, grabbing all the various javascripts, and then using PHP to do some minifying (remove tab characters and newlines at the very least).
Is that an efficient way of speeding up the site, or could the process of grabbing all the files and minifying them actually slow down the server?
[edited by: Mike521 at 2:28 pm (utc) on Aug 2, 2011]