web optimizations

19
Performance web optimizations

Upload: georgi-tachev

Post on 13-Apr-2017

59 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: web optimizations

Performance web optimizations

Page 2: web optimizations

Optimizations

First page loadRepeated page load

Page 3: web optimizations

Importance1. Sequences/Blockers2. HTML3. CSS4. Images5. JavaScript6. Headers7. Fonts8. Tracking resources

Page 4: web optimizations

Before startMeasure!

Making sure you’re optimizingCan brag laterFind bottlenecks

Page 5: web optimizations

HTMLPHP response timeDB callsNetwork callsHHVMPHPNG (PHP-7)Nginx cache (without Set-Cookie ;) )No redirects

Page 6: web optimizations

Aug 2014

Page 7: web optimizations

HTMLDelete unnecessaryNo HTML comments (except conditional)Minify (careful with new lines)Optimize size (1 roundtrip = 14KB)

Page 8: web optimizations

CSSMinifyOptimize selectors (avoid duplicate resource load)

Remove not neededInline if(“we optimize for first load” && “it’s not too big”)

Minimize requests count if(“one request is not too big”)

Page 9: web optimizations

JavaScriptMinifyUse single, async file if possibleDon’t count on it for rendering the pageMake sure you’re optimizing with late-loading

Page 10: web optimizations

Gzip

Gzip level ~6Gzip static

Build foo.js to foo.js.gz and bar.css to bar.css.gz in build time

Page 11: web optimizations

HeadersHTML:Cache-Control:no-store, no-cache, must-revalidate, post-check=0, pre-check=0

CSS, JS, Images, fontsCache-Control:max-age=604800Date:Mon, 12 Jan 2015 16:23:25 GMTETag:"54aa848a-1609d"Expires:Mon, 19 Jan 2015 16:23:25 GMTLast-Modified:Mon, 05 Jan 2015 12:33:14 GMT

Page 12: web optimizations

ImagesOptimize file sizeUse progressive renderingUse sprites when possibleUse Base64 (don’t shoot yourself)

Use responsive designSpecify image dimensions if possibleCheck for duplicates

Page 13: web optimizations

Fonts

No custom fonts if possible (fight to the last drop of blood)

Light fonts if possible (zh)

Page 14: web optimizations

SequencesDNS lookupHTML sizeBlocking CSSBlocking JSConcurrent downloading (~100KB max)

Page 15: web optimizations

CDN

Check for blocking DNS lookupsIf CSS is inline change the relative paths to absolute

Page 16: web optimizations

After finishMeasureFind bottlenecksFind imperfectionsNo imperfections ? “brag” : “optimize again”

Page 17: web optimizations

Examples

Page 18: web optimizations

Tools

http://www.monitis.com/pageload/http://gtmetrix.com/http://www.webpagetest.org/https://developers.google.com/speed/pagespeed/insights/Chrome audit

Page 19: web optimizations

Thank you!