-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
executable file
·611 lines (532 loc) · 22.2 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<title>The Road to Web Performance in 3 Critical Steps</title>
<link rel="stylesheet" href="https://hmagrini.github.io/amsterdamjs-2017/css/reveal.css">
<link rel="stylesheet" href="https://hmagrini.github.io/amsterdamjs-2017/css/theme/udacity.css">
<link rel="stylesheet" href="https://hmagrini.github.io/amsterdamjs-2017/css/udacity-overrides.css">
<!-- Theme used for syntax highlighting of code -->
<link rel="stylesheet" href="https://hmagrini.github.io/amsterdamjs-2017/lib/css/zenburn.css">
<link rel="stylesheet" href="https://hmagrini.github.io/amsterdamjs-2017/lib/css/flexboxgrid.min.css">
<!-- Printing and PDF exports -->
<script>
var link = document.createElement('link');
link.rel = 'stylesheet';
link.type = 'text/css';
link.href = window.location.search.match(/print-pdf/gi)
? 'https://hmagrini.github.io/amsterdamjs-2017/css/print/pdf.css'
: 'https://hmagrini.github.io/amsterdamjs-2017/css/print/paper.css';
document.getElementsByTagName('head')[0].appendChild(link);
</script>
</head>
<body class="udacity">
<div class="reveal">
<div class="slides">
<img class="udacity-logo--white svg--unstyled" src="https://hmagrini.github.io/amsterdamjs-2017/images/logo-udacity--white.svg" alt="">
<section class="row center-xs middle-xs"
data-state="segue segue-gradient--green-purple udacity-logo--white_show">
<div class="col-xs-12">
<h1>The Road to Web Performance in 3 Critical Steps</h1>
<h3 class="subtitle">AmsterdamJS 2017</h3>
</div>
</section>
<section class="row start-xs middle-xs"
data-state="segue segue-lower-corner--blue-green">
<div class="col-xs-8">
<h1>Hernán Magrini</h1>
<h3 class="subtitle">Front End Engineer - Udacity Europe</h3>
</div>
<div class="col-xs-4 start-xs">
<img class="svg unstyled" data-src="https://hmagrini.github.io/amsterdamjs-2017/images/germany-map.svg" alt="">
</div>
</section>
<section class="row start-xs middle-xs"
data-state="segue segue-lower-corner--purple-magenta">
<div class="col-xs-12">
<h1>Disclaimer</h1>
<ul>
<li class="fragment">
<h2>No time for deep dive</h2>
</li>
<li class="fragment">
<h2>It's about the process</h2>
</li>
</ul>
</div>
</section>
<section class="row start-xs middle-xs"
data-state="segue segue-gradient--blue-green">
<div class="col-xs-12">
<h1>What is Performance?</h1>
</div>
</section>
<section class="row center-xs middle-xs"
data-state="segue segue--blue">
<h2>Network: 3G (100ms, 250-750 kb/s)</h2>
<video data-autoplay controls src="https://hmagrini.github.io/amsterdamjs-2017/videos/progressive-loading.mov" ></video>
</section>
<section class="row center-xs middle-xs"
data-state="segue segue--blue">
<h2>Network: 3G (100ms, 250-750 kb/s)</h2>
<video data-autoplay controls src="https://hmagrini.github.io/amsterdamjs-2017/videos/blank-loading.mov" ></video>
</section>
<section class="row start-xs middle-xs"
data-state="segue segue-gradient--blue-green">
<div class="col-xs-12">
<h1>Performance is an experience</h1>
</div>
</section>
<section class="row start-xs middle-xs"
data-state="segue segue-gradient--blue-green">
<div class="col-xs-12">
<h1>Measure!</h1>
<h2>Road to Performance: Step 1</h2>
</div>
</section>
<section class="row start-xs middle-xs"
data-state="colorize colorize-gradient--blue-green"
data-background-image="/images/devtools-bg.png">
<div class="col-xs-12">
<h1>Chrome Dev Tools</h1>
</div>
</section>
<section class="row start-xs middle-xs center-xs"
data-state="segue segue-gradient--blue-green">
<div class="col-xs-12">
<img class="unstyled" data-src="https://hmagrini.github.io/amsterdamjs-2017/images/devtools-network.png" alt="">
</div>
</section>
<section class="row start-xs middle-xs center-xs"
data-state="segue segue-gradient--blue-green">
<div class="col-xs-12">
<img class="unstyled" data-src="https://hmagrini.github.io/amsterdamjs-2017/images/devtools-performance.png" alt="">
</div>
</section>
<section class="row start-xs middle-xs center-xs"
data-state="segue segue-gradient--blue-green">
<div class="col-xs-12">
<img class="unstyled" data-src="https://hmagrini.github.io/amsterdamjs-2017/images/devtools-audit.png" alt="">
</div>
</section>
<section class="row start-xs middle-xs"
data-state="colorize colorize-gradient--blue-green"
data-background-image="/images/pagespeed-bg.png">
<div class="col-xs-12">
<h1>Page Speed Insights</h1>
</div>
</section>
<section class="row start-xs middle-xs center-xs"
data-state="segue segue-gradient--blue-green">
<div class="col-xs-12">
<img class="unstyled" data-src="https://hmagrini.github.io/amsterdamjs-2017/images/pagespeed-ud.png" style="width: 65%" alt="">
</div>
</section>
<section class="row start-xs middle-xs"
data-state="colorize colorize-gradient--blue-green"
data-background-image="/images/webpagetest-bg.png">
<div class="col-xs-12">
<h1>Web Page Test</h1>
</div>
</section>
<section class="row start-xs middle-xs center-xs"
data-state="segue segue-gradient--blue-green">
<div class="col-xs-12">
<img class="unstyled" data-src="https://hmagrini.github.io/amsterdamjs-2017/images/webpagetest-ud.png" style="width: 70%" alt="">
</div>
</section>
<section class="row start-xs middle-xs"
data-state="colorize colorize-gradient--blue-green"
data-background-image="/images/lighthouse-bg.png">
<div class="col-xs-12">
<h1>Lighthouse</h1>
</div>
</section>
<section class="row start-xs middle-xs center-xs"
data-state="segue segue-gradient--blue-green">
<div class="col-xs-12">
<img class="unstyled" data-src="https://hmagrini.github.io/amsterdamjs-2017/images/lighthouse-ud.png" style="width: 75%" alt="">
</div>
</section>
<section class="row start-xs middle-xs"
data-state="segue segue-gradient--blue-green">
<div class="col-xs-12">
<h1>Real world metrics</h1>
</div>
</section>
<section class="row start-xs middle-xs center-xs"
data-state="segue segue-gradient--blue-green">
<div class="col-xs-12">
<h2>Tracking: First Paint</h2>
<pre>
<code class="javascript" data-trim data-noescape>
const observer = <mark>new PerformanceObserver</mark>((list) => {
for (const entry of list.getEntries()) {
// `name` will be either 'first-paint' or 'first-contentful-paint'.
const metricName = entry.name;
const time = Math.round(entry.startTime + entry.duration);
ga('send', 'event', {
eventCategory: 'Performance Metrics',
eventAction: metricName,
eventValue: time,
nonInteraction: true,
});
}
});
// Start observing paint entries.
observer.observe<mark>({entryTypes: ['paint']})</mark>;
</code>
</pre>
</div>
</section>
<section class="row start-xs middle-xs center-xs"
data-state="segue segue-gradient--blue-green">
<div class="col-xs-12">
<h2>Tracking: Long Tasks</h2>
<pre>
<code class="javascript" data-trim data-noescape>
const observer = <mark>new PerformanceObserver</mark>((list) => {
for (const entry of list.getEntries()) {
ga('send', 'event', {
eventCategory: 'Performance Metrics',
eventAction: 'longtask',
eventValue: Math.round(entry.startTime + entry.duration),
eventLabel: JSON.stringify(entry.attribution),
});
}
});
observer.observe<mark>({entryTypes: ['longtask']})</mark>;
</code>
</pre>
</div>
</section>
<section class="row start-xs middle-xs center-xs"
data-state="segue segue-gradient--blue-green">
<div class="col-xs-12">
<h2>Tracking: Time to Interactive</h2>
<pre>
<code class="javascript" data-trim data-noescape>
<mark>import ttiPolyfill from './path/to/tti-polyfill.js';</mark>
ttiPolyfill.<mark>getFirstConsistentlyInteractive()</mark>.then((tti) => {
ga('send', 'event', {
eventCategory: 'Performance Metrics',
eventAction: 'TTI',
eventValue: tti,
nonInteraction: true,
});
});
</code>
</pre>
</div>
</section>
<section class="row start-xs middle-xs"
data-state="segue segue-gradient--green-purple">
<div class="col-xs-12">
<h1>Optimize!</h1>
<h2>Road to Performance: Step 2</h2>
</div>
</section>
<section class="row start-xs middle-xs"
data-state="segue segue-gradient--green-purple">
<div class="col-xs-12">
<h1>Minification</h1>
</div>
</section>
<section class="row start-xs middle-xs"
data-state="segue segue-gradient--green-purple">
<div class="col-xs-12">
<h1>Defer non-critical Asset Loading</h1>
<h2>(aka: optimizing the Critical Path)</h2>
</div>
</section>
<section class="row start-xs middle-xs"
data-state="segue segue-gradient--magenta-orange">
<div class="col-xs-12">
<h1>Javascript Optimization</h1>
</div>
</section>
<section class="row start-xs middle-xs center-xs"
data-state="segue segue-gradient--magenta-orange">
<div class="col-xs-12">
<h1>script async attribute</h1>
<pre>
<code class="html" data-trim data-noescape>
<script <mark>async</mark> src="foobar.js" onload="myFunction()"></script>
</code>
</pre>
<img class="unstyled" data-src="https://hmagrini.github.io/amsterdamjs-2017/images/js-async.png" alt="">
</div>
</section>
<section class="row start-xs middle-xs center-xs"
data-state="segue segue-gradient--magenta-orange">
<div class="col-xs-12">
<h1>script defer attribute</h1>
<pre>
<code class="html" data-trim data-noescape>
<script <mark>defer</mark> src="foobar.js" onload="myFunction()"></script>
</code>
</pre>
<img class="unstyled" data-src="https://hmagrini.github.io/amsterdamjs-2017/images/js-defer.png" alt="">
</div>
</section>
<section class="row start-xs middle-xs"
data-state="segue segue-gradient--purple-magenta">
<div class="col-xs-12">
<h1>CSS Optimization</h1>
</div>
</section>
<section class="row start-xs middle-xs"
data-state="segue segue-gradient--purple-magenta">
<div class="col-xs-12">
<h1>Inline your above the fold CSS</h1>
<h2>(aka Critical CSS)</h2>
</div>
</section>
<section class="row start-xs middle-xs center-xs"
data-state="segue segue-gradient--purple-magenta">
<div class="col-xs-12">
<h1>Un-blocking rendering</h1>
<pre>
<code class="html" data-trim data-noescape>
<link href="style.css" rel="stylesheet">
<link href="print.css" rel="stylesheet" <mark>media="print"</mark>>
<link href="other.css" rel="stylesheet" <mark>media="(min-width: 40em)"</mark>>
</code>
</pre>
</div>
</section>
<section class="row start-xs middle-xs"
data-state="segue segue-gradient--purple-magenta">
<div class="col-xs-12">
<h1>Remove Unused Styles</h1>
</div>
</section>
<section class="row start-xs middle-xs"
data-state="segue segue-gradient--green-purple">
<div class="col-xs-12">
<h1>Font Optimization</h1>
</div>
</section>
<section class="row start-xs middle-xs center-xs"
data-state="segue segue-gradient--green-purple">
<div class="col-xs-12">
<h1>Use Fewer Fonts</h1>
<a href="https://www.bramstein.com/writing/web-font-anti-patterns-subsetting.html">
<img class="unstyled" style="width: 50%"
data-src="https://hmagrini.github.io/amsterdamjs-2017/images/font-subsetting.png" alt="">
</a>
</div>
</section>
<section class="row start-xs middle-xs center-xs"
data-state="segue segue-gradient--green-purple">
<div class="col-xs-12">
<h1>Load Fonts Asynchronously</h1>
<a href="https://github.com/zachleat/fontfaceonload">
<img class="unstyled" style="width: 70%"
data-src="https://hmagrini.github.io/amsterdamjs-2017/images/font-async.png" alt="">
</a>
</div>
</section>
<section class="row start-xs middle-xs"
data-state="segue segue-gradient--green-purple">
<div class="col-xs-12">
<h1>Cache Fonts Aggressively</h1>
</div>
</section>
<section class="row start-xs middle-xs"
data-state="segue segue-gradient--blue-green">
<div class="col-xs-12">
<h1>Image Optimization</h1>
</div>
</section>
<section class="row start-xs middle-xs center-xs"
data-state="segue segue-gradient--blue-green">
<div class="col-xs-12">
<h1>Progressive load above the fold</h1>
<video data-autoplay loop
style="width: 50%"
src="https://hmagrini.github.io/amsterdamjs-2017/videos/images-lazyload.mov" ></video>
</div>
</section>
<section class="row start-xs middle-xs"
data-state="segue segue-gradient--blue-green">
<div class="col-xs-12">
<h1>Defer every other image</h1>
</div>
</section>
<section class="row start-xs middle-xs"
data-state="segue segue-gradient--green-purple">
<div class="col-xs-12">
<h1>Network Optimization</h1>
</div>
</section>
<section class="row start-xs middle-xs"
data-state="segue segue-gradient--green-purple">
<div class="col-xs-12">
<h1>GZIP all your text</h1>
</div>
</section>
<section class="row start-xs middle-xs"
data-state="segue segue-gradient--green-purple">
<div class="col-xs-12">
<h1>HTTP/2</h1>
</div>
</section>
<section class="row start-xs middle-xs center-xs"
data-state="segue segue-gradient--green-purple">
<div class="col-xs-12">
<h1>Prefetch and Preconnect</h1>
<pre>
<code class="html" data-trim data-noescape>
<link <mark>rel="dns-prefetch"</mark> href="//www.example.com">
<link href='https://cdn.keycdn.com' <mark>rel='preconnect'</mark> crossorigin>
</code>
</pre>
</div>
</section>
<section class="row start-xs middle-xs center-xs"
data-state="segue segue-gradient--green-purple">
<div class="col-xs-12">
<h1>Preload</h1>
<pre>
<code class="html" data-trim data-noescape>
<mark><link rel="preload" href="used-later.js" as="script"></mark>
<!-- ...other HTML... -->
<script>
// Later on, after some condition has been met, we run the preloaded
// JavaScript by inserting a <script> tag into the DOM.
var usedLaterScript = document.createElement('script');
usedLaterScript.src = 'used-later.js';
<mark>document.body.appendChild(usedLaterScript)</mark>
</script>
</code>
</pre>
</div>
</section>
<section class="row start-xs middle-xs"
data-state="segue segue-gradient--blue-green">
<div class="col-xs-12">
<h1>Deliver Consistency</h1>
<h2>Road to Performance: Step 3</h2>
</div>
</section>
<section class="row start-xs middle-xs"
data-state="segue segue-gradient--blue-green">
<div class="col-xs-12">
<h1>LiFi and Offline</h1>
</div>
</section>
<section class="row start-xs middle-xs"
data-state="segue segue-gradient--blue-green">
<div class="col-xs-12">
<h1>Service Workers</h1>
</div>
</section>
<section class="row start-xs middle-xs center-xs"
data-state="segue segue-gradient--blue-green">
<div class="col-xs-12">
<h1>workboxjs.org</h1>
<img class="unstyled" style="width: 50%"
data-src="https://hmagrini.github.io/amsterdamjs-2017/images/sw-as-dependency.png" alt="">
</div>
</section>
<section class="row start-xs middle-xs"
data-state="segue segue-gradient--blue-green">
<div class="col-xs-12">
<h1>why use workbox?</h1>
<ul>
<li>Precaching URLs easily and reliably.</li>
<li>Incrementing a cache version string to ensure that precached resources are updated.</li>
<li>Implementing a cache expiration strategy to account for cache size or entry age.</li>
<li>Building common patterns such as lie-fi network timeouts and boilerplate code.</li>
<li>Capturing and reporting analytics data during offline usage.</li>
</ul>
</div>
</section>
<section class="row start-xs middle-xs"
data-state="segue segue-gradient--green-purple">
<div class="col-xs-12">
<h1>In Summary...</h1>
</div>
</section>
<section class="row start-xs middle-xs"
data-state="segue segue-gradient--green-purple">
<div class="col-xs-12">
<h1>Measure</h1>
<h2 class="fragment">"The Road to Web Performance in 3 Critical Steps"</h2>
<ul class="fragment">
<li>Characters: 47</li>
<li>Words: 9</li>
<li>Reading Time: 00:00:02</li>
</ul>
</div>
</section>
<section class="row start-xs middle-xs"
data-state="segue segue-gradient--green-purple">
<div class="col-xs-12">
<h1>Optimize</h1>
<h2 class="fragment">"Critical Steps to Web Perf"</h2>
<ul class="fragment">
<li>Characters: 26</li>
<li>Words: 5</li>
<li>Reading Time: 00:00:01</li>
</ul>
</div>
</section>
<section class="row start-xs middle-xs"
data-state="segue segue-gradient--green-purple">
<div class="col-xs-12">
<h1>Deliver Consistency</h1>
<h2><a href="https://hmagrini.github.io/amsterdamjs-2017/http://localhost:9999" target="_blank"
style="color: white;">Quick Demo!</a></h2>
</div>
</section>
<section class="row start-xs middle-xs"
data-state="segue segue-gradient--green-purple udacity-logo--white_show">
<div class="col-xs-12">
<h1>THANK YOU!</h1>
<h2>@hermagrini</h2>
</div>
<aside class="notes">
</aside>
</section>
</div>
</div>
<script src="https://hmagrini.github.io/amsterdamjs-2017/lib/js/head.min.js"></script>
<script src="https://hmagrini.github.io/amsterdamjs-2017/js/reveal.js"></script>
<script>
// More info https://github.com/hakimel/reveal.js#configuration
Reveal.initialize({
history: true,
progress: false,
viewDistance: 2,
// We use http://flexboxgrid.com/ to easily move stuff around, so we don't need
// RevealJS auto centering
center: false,
// 16:9 RATIO
/* Comment this to disable */
width: 1920,
height: 1080,
// 4:3 RATIO
/* Remove this comment to enable
width: 960,
height: 700,
*/
// Factor of the display size that should remain empty around the content
margin: 0.1,
// Bounds for smallest/largest possible scale to apply to content
minScale: 0.2,
maxScale: 1.5,
// More info https://github.com/hakimel/reveal.js#dependencies
dependencies: [
// Default dependencies
{ src:'https://hmagrini.github.io/amsterdamjs-2017/plugin/markdown/marked.js' },
{ src:'https://hmagrini.github.io/amsterdamjs-2017/plugin/markdown/markdown.js' },
{ src:'https://hmagrini.github.io/amsterdamjs-2017/plugin/notes/notes.js', async: true },
{ src:'https://hmagrini.github.io/amsterdamjs-2017/plugin/highlight/highlight.js', async: true, callback: function () { hljs.initHighlightingOnLoad(); } }
]
});
</script>
</body>
</html>