SitePoint Sponsor

User Tag List

Results 1 to 10 of 10
  1. #1
    SitePoint Wizard
    Join Date
    Feb 2007
    Location
    Southern California
    Posts
    1,340
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    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?

  2. #2
    padawan silver trophybronze trophy markbrown4's Avatar
    Join Date
    Jul 2006
    Location
    Victoria, Australia
    Posts
    4,108
    Mentioned
    28 Post(s)
    Tagged
    2 Thread(s)
    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.

  3. #3
    SitePoint Wizard bronze trophy Jeff Mott's Avatar
    Join Date
    Jul 2009
    Posts
    1,266
    Mentioned
    18 Post(s)
    Tagged
    0 Thread(s)
    There are many techniques to speed up a web page, several of which are more significant than minifying.

    http://developer.yahoo.com/performance/rules.html

    Try to implement as many of these performance rules as you can. They're ordered, with the most significant at the top.
    "First make it work. Then make it better."

  4. #4
    SitePoint Member
    Join Date
    Jul 2012
    Posts
    9
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by markbrown4 View Post
    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.
    +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

  5. #5
    SitePoint Wizard
    Join Date
    Feb 2007
    Location
    Southern California
    Posts
    1,340
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Jeff Mott View Post
    There are many techniques to speed up a web page, several of which are more significant than minifying.

    http://developer.yahoo.com/performance/rules.html

    Try to implement as many of these performance rules as you can. They're ordered, with the most significant at the top.
    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.

  6. #6
    SitePoint Wizard
    Join Date
    Feb 2007
    Location
    Southern California
    Posts
    1,340
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Matt Tacchi View Post
    +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
    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.

  7. #7
    SitePoint Mentor silver trophybronze trophy
    Mikl's Avatar
    Join Date
    Dec 2011
    Location
    Edinburgh, Scotland
    Posts
    1,554
    Mentioned
    63 Post(s)
    Tagged
    0 Thread(s)
    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

  8. #8
    SitePoint Wizard
    Join Date
    Feb 2007
    Location
    Southern California
    Posts
    1,340
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    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.

  9. #9
    SitePoint Wizard webcosmo's Avatar
    Join Date
    Oct 2007
    Location
    Boston, MA
    Posts
    1,480
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    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.

  10. #10
    SitePoint Wizard
    Join Date
    Feb 2007
    Location
    Southern California
    Posts
    1,340
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    webcosmo, thanks. There are only 0-1 images per page The database queries are simple and can't be cut down further.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •