top | item 6928118

The Right Stuff: Breaking the PageSpeed Barrier with Bootstrap

118 points| trjordan | 12 years ago |appneta.com

33 comments

order
[+] cbr|12 years ago|reply
While they do point out Ilya's comment in an update, it should be more central:

    Here's a slightly modified MPS config that gets you to
    100 without any manual work:

      ModPageSpeed on
      ModPagespeedRewriteLevel CoreFilters
      ModPagespeedEnableFilters prioritize_critical_css
      ModPagespeedEnableFilters defer_javascript
      ModPagespeedEnableFilters sprite_images
      ModPagespeedEnableFilters convert_png_to_jpeg
      ModPagespeedEnableFilters convert_jpeg_to_webp
      ModPagespeedEnableFilters collapse_whitespace
      ModPagespeedEnableFilters remove_comments
-- https://github.com/danriti/bootstrap-pagespeed/issues/4

mod_pagespeed can automate all those complicated steps.

(Disclaimer: I work on mod_pagespeed and ngx_pagespeed.)

[+] druiid|12 years ago|reply
I've had huuuuge problems with defer_javascript before using specific libraries. If it works it is an amazing help, but I'd carefully bug-test after you implement if you use that filter!
[+] dave1010uk|12 years ago|reply
Does mod_pagespeed work with Apache 2.4 now?
[+] troyk|12 years ago|reply
Thank you, I can't wait to try this...
[+] notfunk|12 years ago|reply
i updated the article to move the inline update to the `2. Enable mod_pagespeed` section as requested =)
[+] zoj_bad|12 years ago|reply
We have worked pretty hard to push the speed at which our mobile webpages load.

In the interest of sharing...this is what has worked for us:

1. We don't have any references to external CSS and JS files. This means there is almost no reason for the browser to stop painting the webpage as soon as it starts getting the document or even fractions of it. This means that the user never gets impatient cause it seems that his device is doing nothing. I know this seems like a huge management hassle in terms of changing things, but we got over that by using a server side helper library that spits out the HTML of all the components based on certain input parameters. That way the HTML of the user interface is even more modular and centralized than CSS etc. Besides, it also makes the making of new pages a craft project of sticking different user interface blocks together.

2. All user-interface images for buttons and icons and all are in image sprites. So, an average page is just 2-3 requests. Also sprites once cached load beautifully. In fact, it also makes for a much more pleasing page load as opposed to some parts of the page coming in and some coming in a little bit later.

3. All background repeating images are make 1px thick and saved as optimized as JPEGS and then made part of the CSS with base64 encoding.

4. Of course we very aggressively cache and reduce DB calls and combine DB calls etc etc.

Having done all this, we find that our pages load...well more or less instantly at least with respect to what matters to an average human. But this instant loading is only on a network where the initial connection time is not relevant. On 2G & 3G even, all the optimizations in the world cant save you from the fact that the device takes a LONG time to just connect as Ilya Grigorik has mentioned in his presentation.

[+] untog|12 years ago|reply
Wait, you inline your JS and CSS? Doesn't that mean that the user has to re-download it with every page? I get the desire to have as few connections going as possible, but just be sensible about caching. First page load downloads the CSS + JS, subsequent page loads just serve it from cache.
[+] paulirish|12 years ago|reply
Love all of this. I'm always looking for well tuned sites like yours to showcase. Can you share a URL?
[+] nachteilig|12 years ago|reply
I just saw google recommending inlining small fragments of css/js in the newer pagespeed guidelines. This has definitely piqued my interest and I wondered if people were doing it, mainly because I'm never sure which side of the speed vs. proper semantics debate I want to be on.
[+] kaishiro|12 years ago|reply
"After Ilya’s talk ended, I started to think more about why performance always seems to be an afterthought with developers."

In my (admittedly somewhat limited) agency experience, performance is rarely an afterthought to developers. Rather, it can be difficult to convince stakeholders that it's worth the extra time to ensure that each of these avenues is thoroughly explored. They'd rather spend their retainer implementing new feature X then making what they've already purchased perform faster.

We do what we can in terms of adding additional time to estimates to account for these things, but it's always a balance. At the end of the day, someone still needs to pay for my time.

[+] mikeyouse|12 years ago|reply
The blog post loads perceptively fast, but what I ran it through the PageSpeed tool, it came up very poor;

http://i.imgur.com/IBpar1y.png

Any ideas on the shortfalls of the ranking, areas where it's not accurate, etc?

[+] recuter|12 years ago|reply
Food for thought: all this wisdom is really an attempt to prioritize how bits hit your browser and is very much due to legacy issues. These are hacks, albeit clever and measurably better.

HTTP2 when it comes (2014?) will negate the need to inline/concatenate CSS or cook up image sprites because it solves it at the proper level, the network layer.

[+] bmcquade|12 years ago|reply
SPDY addresses some shortcomings in HTTP, but you will always have to be mindful of the amount of render blocking JavaScript and CSS loaded on your page, regardless of network protocol.

If you load large amounts of render blocking JS/CSS in the <head>, the browser must wait for it to finish downloading before it can render content in <body> to the screen.

To deliver a fast experience, keep the amount of JS/CSS needed to render the initial view to a minimum. Ideally, that'd be no JS, and just the CSS needed to style the content in the initial view. Then, once the initial view has rendered, load the JS and additional CSS needed for the rest of the app.

[+] mmorris|12 years ago|reply
Looking forward to that!

Unfortunately the question then becomes, how long until all the major browsers support it? And once that happens, how long until the crowd not using the updated browsers is small enough that we can safely ignore them?

I suppose the auto-updating browser trend should help a lot with the latter issue.

[+] sampk|12 years ago|reply
Don't even video games using image sprites for (non-network) performance benefits?