views:

33

answers:

1

I have been doing some performance analysis on a few websites I am working on and I am noticing that a big problem is the inline scripts. For the external scrips I wrote an http handler which combines, minifies, and gzips the javascript into one file. This is then stored for reuse later by hashing the filenames.

What I am wondering (not sure if this is a good idea but I am posting to get some feedback) is if I remove all script elements with script text inside them and combine them into a single file. I then use the same process I am using for the external scripts and combine them into a single script.

John

A: 

Inline script always gets inside the page so needs to be traversed by every post or get to and from the server. Since you're using MVC it's quite easy to only have non obtrusive script files in your project as you have quite some control over the rendered html.

You also want to check out SquishIt.

Grz, Kris.

XIII
JKalberer
It depends on the bandwidth and the amount of inline script you have. Separate css files can be cached by a browser so they only count for the first time hit. Inline script however mostly traverses the line back and forth several times. If you have many of that it could slow down the app. I suggest you try to find the most common pieces of inline script which you can take away and use a tool like __YSlow__ to measure the optimizations.
XIII
I have been basing a lot of my metrics off of YSlow but I will just try this out and post my results later. I just need to think of a good way to minimize the times I have yank the inline scripts out of the rendered page. It would be optimal if I could do this at compile time.
JKalberer