performace optimizations and frontend happiness

40
Performance, Optimization and Frontend Happiness.

Upload: nuriaruiz

Post on 15-Jun-2015

3.831 views

Category:

Documents


0 download

DESCRIPTION

There are two goals when it comes to performance: faster pages and pages that work fast. Performant applications met both goals, pages get to the user fast but also scroll and update responsively. We will go over the not so obvious performance problems we had in those areas the past year and the solutions (or coding practices) that helped us solve the issues.

TRANSCRIPT

Page 1: Performace optimizations and frontend happiness

Performance,Optimization and Frontend Happiness.

Page 2: Performace optimizations and frontend happiness

Nuria Ruiz

@pantojacoder

Page 3: Performace optimizations and frontend happiness

Disclaimer

Page 4: Performace optimizations and frontend happiness

Ground ZeroGround Zero

Page 5: Performace optimizations and frontend happiness

Performance,Optimization and Frontend Happiness.

Page 6: Performace optimizations and frontend happiness

What is the goal?

Page 7: Performace optimizations and frontend happiness

Pages that load faster.

Page 8: Performace optimizations and frontend happiness

Pages that work better.

Page 9: Performace optimizations and frontend happiness

Architecting for Performance.

Page 10: Performace optimizations and frontend happiness

First Pageload.

Page 11: Performace optimizations and frontend happiness

Fastest Javascript is the one you do not have to execute.

First Pageload

Page 12: Performace optimizations and frontend happiness

DOMContentLoaded triggered as soon as possible.

First Pageload

Page 13: Performace optimizations and frontend happiness

Download your JavaScript code on demand.

Page 14: Performace optimizations and frontend happiness
Page 15: Performace optimizations and frontend happiness

Before:1.5MB of JS

DOMContentLoaded in 5.5 seconds

Page 16: Performace optimizations and frontend happiness
Page 17: Performace optimizations and frontend happiness
Page 18: Performace optimizations and frontend happiness

After:DOMContentLoaded in 1.9 seconds

Still High.

Page 19: Performace optimizations and frontend happiness

Optimizing yourMarkup.

Page 20: Performace optimizations and frontend happiness

Too many DOM nodes in a page will (likely) make it

S L O W . .

Page 21: Performace optimizations and frontend happiness

How many aretoo many?

Page 22: Performace optimizations and frontend happiness

1.000?

10.000?

20.000?

Page 23: Performace optimizations and frontend happiness

document.querySelectorAll('*').length

2471

2664

Page 24: Performace optimizations and frontend happiness

Node ExplosionDemo

Page 25: Performace optimizations and frontend happiness

CSSmatters.

Page 26: Performace optimizations and frontend happiness

CSS affectsFramerateScrolling

Page 27: Performace optimizations and frontend happiness

Browser applies CSS rules from right to left

Page 28: Performace optimizations and frontend happiness

Badtreehead treerow treecell {…}

Bad but bettertreehead > treerow > treecell {…}

Best.treecell-header {…}

Page 30: Performace optimizations and frontend happiness

Badp ~ span{…}

<p><span>This is not red.</span><p>Here is a paragraph.<span> ...<span> </span>

</span></p><code>Here is some code.</code><span>And here is a span.</span>

</p>

Page 31: Performace optimizations and frontend happiness

What style is slow?

Disable style, note paintimes.

Page 32: Performace optimizations and frontend happiness

NOT your friends:border-radiusbox-shadow

Page 33: Performace optimizations and frontend happiness

MeasuringPerformance.

Page 34: Performace optimizations and frontend happiness
Page 35: Performace optimizations and frontend happiness
Page 36: Performace optimizations and frontend happiness

Telemetry

http://www.chromium.org/developers/telemetry

Page 37: Performace optimizations and frontend happiness

Where's the Happiness?

Page 38: Performace optimizations and frontend happiness

Faster production environment yields Faster development environment

Page 39: Performace optimizations and frontend happiness

Web workersFlushingPrefetching

Bonus track!

Page 40: Performace optimizations and frontend happiness

Questions?