34
Building high performance web applications Maurice de Beijer @mauricedb @react_tutorial

Building high performance web applications

Embed Size (px)

Citation preview

Page 1: Building high performance web applications

Building high performance web applicationsMaurice de Beijer@mauricedb@react_tutorial

Page 2: Building high performance web applications

© ABL - The Problem Solver 2

Topics

What is fast? Tooling Code splitting Server side rendering Only render above the fold Service worker

Page 3: Building high performance web applications

3

Maurice de Beijer The Problem Solver Microsoft Azure MVP Freelance developer/instructor Twitter: @mauricedb, @NG_Tutorial and

@React_Tutorial Web: http://www.TheProblemSolver.nl E-mail: [email protected]

Page 4: Building high performance web applications

© ABL - The Problem Solver 4

Why? 40% of the web traffic is from mobile devices.

Bol.com in July 2016 Adding 100 ms of latency costs 1% of sales

Amazon.com

Page 5: Building high performance web applications

© ABL - The Problem Solver 5

What is fast?

Page 6: Building high performance web applications

© ABL - The Problem Solver 6

It depends

Page 7: Building high performance web applications

© ABL - The Problem Solver 7

“Performance is the art of avoiding work, and

making any work you do as efficient as possible”

-- Paul Lewis --

Page 8: Building high performance web applications

© ABL - The Problem Solver 8

DOM Content Loaded

Page 9: Building high performance web applications

© ABL - The Problem Solver 9

First meaningful

paint

Page 10: Building high performance web applications

© ABL - The Problem Solver 10

Time to interactive

Page 11: Building high performance web applications

© ABL - The Problem Solver 11

But there is more

Page 12: Building high performance web applications

© ABL - The Problem Solver 12

Tooling

Page 13: Building high performance web applications

© ABL - The Problem Solver 13

ChromeTimeline

Page 14: Building high performance web applications

© ABL - The Problem Solver 14

ChromeAudits

Page 15: Building high performance web applications

© ABL - The Problem Solver 15

YSlow

Page 16: Building high performance web applications

© ABL - The Problem Solver 16

WebPageTest

Page 17: Building high performance web applications

© ABL - The Problem Solver 17

WebPageTest

select the device

Page 18: Building high performance web applications

© ABL - The Problem Solver 18

WebPageTest

select the bandwidth

Page 19: Building high performance web applications

© ABL - The Problem Solver 19

WebPageTest

iPhone 6

Page 20: Building high performance web applications

© ABL - The Problem Solver 20

Lighthouse

Page 21: Building high performance web applications

© ABL - The Problem Solver 21

Use source-map-

explorer

Page 22: Building high performance web applications

© ABL - The Problem Solver 22

ECMAScript imports

import _ from 'lodash';_.forEach(data, e => console.log(e));

import { forEach } from 'lodash/forEach';forEach(data, e => console.log(e));

Page 23: Building high performance web applications

© ABL - The Problem Solver 23

import rxjs from 'rxjs';rxjs.Observable.from(data) .map(e => 2 * e) .subscribe(e => console.log(e));

ECMAScript imports import { Observable } from 'rxjs/Observable';

import 'rxjs/add/observable/from';import 'rxjs/add/operator/map';Observable.from(data) .map(e => 2 * e) .subscribe(e => console.log(e));

Page 24: Building high performance web applications

© ABL - The Problem Solver 24

15 minute pauze

Page 25: Building high performance web applications

© ABL - The Problem Solver 25

Code splitting

Page 26: Building high performance web applications

© ABL - The Problem Solver 26

Right size framework

Page 27: Building high performance web applications

© ABL - The Problem Solver 27

Server side rendering

Page 28: Building high performance web applications

© ABL - The Problem Solver 28

Inlinecritical

CSS

Page 29: Building high performance web applications

© ABL - The Problem Solver 29

Only render above the

fold

Page 30: Building high performance web applications

© ABL - The Problem Solver 30

HTTP&

Latency

Page 31: Building high performance web applications

© ABL - The Problem Solver 31

Service Worker

(App-Cache)

Page 32: Building high performance web applications

© ABL - The Problem Solver 32

Try it http://bit.ly/fast-apps

Page 33: Building high performance web applications

© ABL - The Problem Solver 33

Conclusion

Everyone loves faster web apps. And they are good for business

Avoid or delay as much as possible. What you don’t do can’t slow you down

Do as few request as possible to display the first page.

The fastest HTTP request is one not made Use the browsers capabilities as much as possible.

Page 34: Building high performance web applications

© ABL - The Problem Solver 34

Maurice de Beijer

@mauricedb

[email protected]