deep dive into front end performance

65
Performance Deep Dive

Upload: apoorv-saxena

Post on 08-Aug-2015

455 views

Category:

Technology


5 download

TRANSCRIPT

Page 1: Deep dive into Front end Performance

Performance Deep Dive

Page 2: Deep dive into Front end Performance

Profiling

Page 3: Deep dive into Front end Performance
Page 4: Deep dive into Front end Performance

Show Paint Rectangles

Page 5: Deep dive into Front end Performance
Page 6: Deep dive into Front end Performance

FPS meter

Page 7: Deep dive into Front end Performance
Page 8: Deep dive into Front end Performance

Performance Audits

Page 12: Deep dive into Front end Performance

Concepts related to Rendering Performance

Page 13: Deep dive into Front end Performance

Let’s review a pull requesthttps://github.com/toamitkumar/jschannel2015/pull/10/files

Page 14: Deep dive into Front end Performance

Critical Rendering Path

Page 15: Deep dive into Front end Performance
Page 16: Deep dive into Front end Performance

Style CalculationsReference: CSSTriggers.com

Page 17: Deep dive into Front end Performance
Page 18: Deep dive into Front end Performance

Layout

Page 19: Deep dive into Front end Performance

width overflow height

padding font-family margin

display vertical-align border-width

border clear top

position bottom font-size

float left text-align

overflow-y right line-height

font-weight white-space min-height

Page 20: Deep dive into Front end Performance
Page 21: Deep dive into Front end Performance

Painting

Page 22: Deep dive into Front end Performance

color border-style

visibility background

text-decoration background-image

background-position background-repeat

outline-color outline

outline-style border-radius

background-size box-shadow

Page 23: Deep dive into Front end Performance
Page 24: Deep dive into Front end Performance

Composting

Page 25: Deep dive into Front end Performance

What are the different Performance bottlenecks?

Page 26: Deep dive into Front end Performance

Memory Leaks

Page 27: Deep dive into Front end Performance

Avoid Forced Synchronous Layouts

Page 28: Deep dive into Front end Performance

Layout ThrashingForced synchronous layout in quick succession

Demo: Animations example

Page 29: Deep dive into Front end Performance

How to avoid Layout Thrashing

Page 30: Deep dive into Front end Performance

Reducing DOM callsConsecutive DOM read/write operations trigger

layout thrashing

Page 31: Deep dive into Front end Performance

Library: FastDomEliminates layout thrashing by batching DOM

read/write operations,

Page 32: Deep dive into Front end Performance

Potential Scroll BottlenecksDemo: Repaint on Scroll

Page 33: Deep dive into Front end Performance
Page 34: Deep dive into Front end Performance

Debounce Input Handlers

Page 35: Deep dive into Front end Performance
Page 36: Deep dive into Front end Performance
Page 37: Deep dive into Front end Performance

Reduce Document Reflows

Page 38: Deep dive into Front end Performance

Simplify Paint Complexity

Page 40: Deep dive into Front end Performance

Reduce number of elements styled

Page 41: Deep dive into Front end Performance

Reduce complexity of CSS selectors

Page 42: Deep dive into Front end Performance

.box:nth-last-child(-n+1) .title {

/* Slow selector */

}

.final-box-title {

/* Performant implementation */

}

Page 43: Deep dive into Front end Performance

Reduce Paint Areas

Page 44: Deep dive into Front end Performance

Avoid Large &

Complex Layout

Page 45: Deep dive into Front end Performance
Page 46: Deep dive into Front end Performance

GPU Acceleration

Page 47: Deep dive into Front end Performance
Page 48: Deep dive into Front end Performance

Canvas is hardware accelerated

Page 49: Deep dive into Front end Performance

Avoid Paint Storms

Page 50: Deep dive into Front end Performance

How to perform Animation at 60fps ?

Page 51: Deep dive into Front end Performance

JS Animations

Page 52: Deep dive into Front end Performance
Page 53: Deep dive into Front end Performance

CSS AnimationsDemo: SnowFlake Animation

Page 54: Deep dive into Front end Performance

Web Animations APIDemo: SnowFlake Animation

Page 55: Deep dive into Front end Performance

GIFs and Performance

Page 56: Deep dive into Front end Performance
Page 57: Deep dive into Front end Performance

PromoteFast performers

Page 58: Deep dive into Front end Performance
Page 59: Deep dive into Front end Performance

.moving-element {

will-change: transform;

transform: translateZ(0);

}

Page 60: Deep dive into Front end Performance

So, why not Promote everyone?

Page 61: Deep dive into Front end Performance

* {

will-change: transform;

transform: translateZ(0);

}

Page 62: Deep dive into Front end Performance

Performance Audit Materialup

Page 63: Deep dive into Front end Performance

Apoorv Saxena@apoorv_saxena

Page 64: Deep dive into Front end Performance
Page 65: Deep dive into Front end Performance

Thank you.