

How To Minimize Your Javascript and CSS Files for Faster Page Loads - chaostheory
http://www.maxkiesler.com/index.php/weblog/comments/how_to_minimize_your_javascript_and_css_files_for_faster_page_loads/

======
edw519
I've always had an instinctual resistance to using lots of outside building
blocks unless there was a real compelling reason. Now, it sounds like using
javascript libraries like scriptalicious causes performance problems. Did I
read this right?

Also, I understand the need for obfuscation, but to improve page load speed?
How?

~~~
DanielBMarkham
Yes you read it right. Anything you load into the browser, both in terms of
size and additional http requests, is a performance hit.

Obfuscation helps improve performance speed by making the variables as small
as possible while avoiding name collisions. In practice this probably means a
file full of one-letter variables, instead of things like elemResult

Every byte that is in your Javascript that has to be downloaded to the client
is another millisecond or more of response time. This is the reason why I
wouldn't use huge honking JS libraries unless I was really sure I needed them
(call me old-fashioned). Interestingly enough, looks like there is a case to
be made for package libraries, where you download one file and it explodes
into both the CSS and JS part of your app. Makes sense to me, although I've
never tried it.

~~~
pc
"Every byte that is in your Javascript that has to be downloaded to the client
is another millisecond or more of response time."

How many people still use 1KB/s net connections?

~~~
DanielBMarkham
It was rhetorical. I didn't do the math. So sue me :)

------
davidw
I used YUI compressor with langpop, which has a big chunk of javascript:

[http://journal.dedasys.com/articles/2007/11/07/yui-
compresso...](http://journal.dedasys.com/articles/2007/11/07/yui-compressor)

------
newzie
if you're using rails, just use the asset packager plugin. it's awesome. and
gzip your javascript and css -- use mod_deflate if you're using apache. that's
all you really need. and mod_expires, if you want to get an 'A' grade from the
yslow firefox/firebug extension.

~~~
chaostheory
I could be wrong but with rails 2.0 it's built-in - so no more need for
bundling plugins once it's out (unless you want javascript minfication)

------
DanielBMarkham
Excellent resource. Thanks.

