stevenhu — 2012-07-13T19:04:59-04:00 — #1
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?
markbrown4 — 2012-07-14T01:45:12-04:00 — #2
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.
jeff_mott — 2012-07-14T08:24:18-04:00 — #3
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.
matt_tacchi — 2012-07-16T06:21:10-04:00 — #4
stevenhu — 2012-07-16T12:28:36-04:00 — #5
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.
stevenhu — 2012-07-16T12:35:42-04:00 — #6
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.
mikl — 2012-07-16T12:57:31-04:00 — #7
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.
stevenhu — 2012-07-16T13:05:35-04:00 — #8
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.
webcosmo — 2012-07-16T23:13:14-04:00 — #9
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.
stevenhu — 2012-07-17T19:01:45-04:00 — #10
webcosmo, thanks. There are only 0-1 images per page The database queries are simple and can't be cut down further.