Disappointed with performance after minimizing code

I was surprised at the lackluster results after minimizing my Javascript and CSS code (both Jquery), and commenting out all text shadows, box shadows, and border-radius.

Before minimizing or commenting out the above areas, cycling through 12 HTML pages took 38.15 seconds.
After minimizing and commenting out all of the above, 34.30 sec.

I used the YUI compressor for JS and CSS. This is for the iPhone. There is a white flash between pages.

I thought I would get more dramatic time savings across 12 pages. Should I have expected better?
Comments? Suggestions?

I’m not exactly sure what you were trying to test here, how are you timing cycling through 12 HTML pages?

Compressing the js and css only makes a difference to file size so that the initial page load is quicker, after it’s cached it won’t effect it noticeably.
If you have many scripts and stylesheets on a page combining them will have a big impact on download times because the requests is where the big amount of time is spent.

I don’t know why you commented out the CSS3, this shouldn’t effect load times but can sometimes slow down things like scrolling if used heavily.

There are many techniques to speed up a web page, several of which are more significant than minifying.

Try to implement as many of these performance rules as you can. They’re ordered, with the most significant at the top.

+1, compression should only affect initial page load times. If you want to improve the performance of your JavaScript code you need to think about how you right your code. Also some browsers have much faster JavaScript engines than others (e.g. Google Chrome is super fast), so there are many variables in the equation :slight_smile:

This page is a terrific resource. However, my code is for the iPhone, and the code is entirely self-contained. There are no http requests to a server, so 99% of these tips do not apply. The pages are mostly of text fields and option boxes, 0-1 images. There are several JS scripts externally loaded.

The personal JS code is very straightforward; mostly writing and reading in database values for the fields on that page. I don’t think I can get it simpler. However, I am also using Jquery, and that’s probably the biggest roadblock for performance.

+1 about compression only affecting initial page load times. Unfortunately, the page load time savings was negligible across 12 pages.

[FONT=verdana]I don’t see the point in commenting-out code. After all, the server still has to serve the commented-out code, it still has to travel across the network, and it still has to be read by the browser. If you don’t want the stuff you’ve commented out, better to remove it completely.

Of course, commenting-out server-side code (or compiled code) is a different matter.

Mike[/FONT]

Thanks, Mikl; good point. The commented-out code was removed prior to minifying when I did the tests a second time, and that is the time recorded in the OP. Not much performance savings.

this is definitely not your html, css code issue.
here are some sources that you could look at:

  • are you using too many images? if so save them as jpeg lowering their quality. or present them differently so they all dont load as page load.
  • are you accessing database on that page? this is a very common cause that makes sites slow, for dynamic sites. if you use db, check queries.

webcosmo, thanks. There are only 0-1 images per page :slight_smile: The database queries are simple and can’t be cut down further.