Make the entire web faster
Delay | User reaction |
---|---|
0-100ms | Instant |
0-300ms | Feels sluggish |
100-1000ms | Machine is working... |
1s+ | Mental context switch |
10s+ | I'll come back later... |
Mean (s) | Median (s) | |
---|---|---|
Japan | 5.9 | 3.5 |
Singapore | 12.0 | 5.9 |
China | 12.0 | 5.6 |
Indonesia | 12.4 | 5.6 |
Malaysia | 13.2 | 6.2 |
Thailand | 16.3 | 5.9 |
India | 16.3 | 7.4 |
Modest to no noticeable speedup after 5mbps! Errrrr.. why!?
Content Type | Avg # of Requests | Avg size |
---|---|---|
HTML | 8 | 44kB |
Images | 53 | 635kB |
Javascript | 14 | 189kB |
CSS | 5 | 35kB |
(faster) connectivity won't save us, better protocols can help, but...
we need you to build faster pages
TODO: optimize 5 through 7, rinse, lather, repeat.
Created via webpagetest.org: IE 8, from Tokyo... Yikes?
<script> _gaq.push(['_setAccount','UA-XXXX-X']); _gaq.push(['_setSiteSpeedSampleRate', 100]); // #protip _gaq.push(['_trackPageview']); </script>
Google Analytics > Content > Site Speed
Content > Site Speed > Page Timings > Performance
Migrated site to new host, server stack, web layout, and using static generation. Result: noticeable shift in the user page load time distribution.
Content > Site Speed > Page Timings > Performance
Bimodal response time distribution?
Theory: user cache vs. database cache vs. full recompute
<script> _gaq.push(['_trackTiming', 'category', 'label', time]); _gaq.push(['_trackTiming', 'jQuery', 'Load library', 20]); _gaq.push(['_trackTiming', 'slide', slideNum, timeOnSlide]); // ^^^ win. </script>
ResourceTiming interface to allow Javascript mechanisms to collect complete timing information related to resources on a document.
W3C draft / work in progress
cnn.com waterfall: blocking JS requests, missing assets, missing cache headers on images and JS. Plenty of room for improvement.
Question: what are the blue and red lines in the waterfall?
<script src="file-a.js"></script> <script src="file-b.js" defer></script> <script src="file-c.js" async></script>
<script src="file-a.js"></script> <script src="file-b.js" defer></script> <script src="file-c.js" async></script>
cnn.com timeline: evaluate every request, track JS execution time, style reflows, etc.
60%+ of the weight of the page is images (on average)
Goal: no surprises in the recommendations.
Open-source Apache module that automatically optimizes web pages and associated resources.
ModPagespeedCssInlineMaxBytes 2048 ModPagespeedImageInlineMaxBytes 2048 ModPagespeedCssImageInlineMaxBytes 2048 ModPagespeedJsInlineMaxBytes 2048 ModPagespeedCssOutlineMinBytes 3000 ModPagespeedJsOutlineMinBytes 3000 ModPagespeedRetainComments "[WILDCARD PATTERN]" ModPagespeedJpegRecompressionQuality -1 ModPagespeedImageLimitOptimizedPercent 100 ModPagespeedImageLimitResizeAreaPercent 100 ModPagespeedMaxInlinedPreviewImagesIndex 5 ModPagespeedMinImageSizeLowResolutionBytes 10240 // ...
<VirtualHost *:80> ServerName www.awesome-rails-app.com DocumentRoot /apps/foo/public PassengerEnabled on ModPagespeed on /* ... */ </VirtualHost>
+Ilya Grigorik, @igrigorik, igrigorik@google.com
Blog @ www.igvita.com