-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
306 lines (263 loc) · 7.85 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
<!doctype HTML>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=1024" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<title>10 Web App Performance Pitfalls</title>
<link href="css/screen.css" media="screen" rel="stylesheet" type="text/css" />
<link href='https://fonts.googleapis.com/css?family=Roboto:400,300' rel='stylesheet' type='text/css'>
</head>
<body>
<div id="impress">
<div class="step title" data-x="-1500" data-y="0" >
10 Web App Performance Pitfalls
<br/>
<br/>
@hoxtonone
</div>
<div class="step title" data-x="0" data-y="0" >
<img height="750px" src="images/cloud9.png">
</div>
<div class="step title" data-x="1500" data-y="0" >
<img height="600px" src="images/audiotool.jpg">
</div>
<!-- STEP: Overview -->
<div class="step overview" data-x="3000" data-y="0" data-rotate-x="40" >
<div class="container">
<ul class="js">
<li class="head">JS</li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
</ul>
<ul class="css">
<li class="head">CSS</li>
<li></li>
<li></li>
</ul>
<ul class="html">
<li class="head">HTML</li>
<li></li>
</ul>
</div>
</div>
<!-- Convenience Methods and shims -->
<div class="step js title" data-x="-1500" data-y="1500">
Using convenience methods <br />(especially when using shims)
</div>
<div class="step js example" data-x="0" data-y="1500">
<pre><code>
<span class="comment">// slow</span>
longArray.forEach( doSomething );
<span class="comment">// fast</span>
var length = longArray.length;
for( var i = 0; i < length; i++ ) {
doSomething( longArray[ i ] );
}
</code></pre>
</div>
<div class="step js result" data-x="1500" data-y="1500">
<ul class="bar-chart">
<li>
<div class="bar">
<div class="percent">100%</div>
<div class="bg" style="height: 100%"></div>
</div>
<label>for loop</label>
</li>
<li class="low-value">
<div class="bar">
<div class="percent">45%</div>
<div class="bg" style="height: 45%"></div>
</div>
<label>forEach</label>
</li>
<li class="low-value">
<div class="bar">
<div class="percent">15%</div>
<div class="bg" style="height: 15%"></div>
</div>
<label>forEach shim</label>
</li>
</ul>
</div>
<!-- Component Lifecycle -->
<div class="step js title" data-x="-1500" data-y="3000">
Actively manage the component lifecycle
</div>
<div class="step" data-x="0" data-y="3000" >
<img height="750px" src="images/the-merchant.jpg">
</div>
<div class="step js example" data-x="1500" data-y="3000">
<code>
<span class="comment">// when widget is first needed</span>
var widget = new Widget()
widget.init = function() {
// create connection
}
<span class="comment">// when widget is hidden</span>
widget.hide = function() {
// pause connection
}
<span class="comment">// when widget is shown</span>
widget.show = function() {
// resume connection
}
</code>
</div>
<!-- Energetic Templating -->
<div class="step js title" data-x="-1500" data-y="4500">
Framework Templating
</div>
<div class="step js example" data-x="0" data-y="4500">
<code>
<span class="comment">// Markup choice ( Angular ) </span>
<span>{{ firstname }}</span>
<span ng-bind="firstname"></span>
</code>
</div>
<!-- Dirty Checking -->
<div class="step js title" data-x="-1500" data-y="6000">
Dirty Checking
</div>
<div class="step js example" data-x="0" data-y="6000">
<code>
<span class="comment">// Inline function calls</span>
<span ng-bind="computeContent()"></span>
<span class="comment">// Polling</span>
setInterval( function() {
//check if something needs to be done
}, 100 );
</code>
</div>
<div class="step js quote" data-x="1500" data-y="6000">
<div style="width:750px; font-size: 25px" class="quote">
"So the real question is this: can you do 2000 comparisons in 50 ms even on slow browsers? That means that you have 25 µs per comparison. I believe this is not an issue even on slow browsers these days. <b>There is a caveat: the comparisons need to be simple to fit into 25 µs.</b>"
</div>
<div style="width:750px; font-size: 25px; text-align: right" class="quote-by">
Misko Hevery
</div>
</div>
<!-- WebWorkers - Overhead vs Benefit -->
<div class="step js title" data-x="-1500" data-y="7500">
WebWorkers - Overhead vs Benefit
</div>
<div class="step js example" data-x="0" data-y="7500">
<img src="images/worker_perf.png">
blog.scottlogic.com
</div>
<!-- Work with your compiler, not against it -->
<div class="step js title" data-x="-1500" data-y="9000">
Work with your compiler, not against it
</div>
<div class="step js example" data-x="0" data-y="9000">
<code>
<span class="comment">// Try Catch</span>
try {
//do something
} catch( e ) {
// error occured
}
<span class="comment">// Accessing items that is out of index bounds</span>
var anArray = [ 'apple', 'oranges', 'kiwis' ];
anArray[ 10 ];
</code>
</div>
<div class="step js result" data-x="1500" data-y="9000">
<ul class="bar-chart">
<li>
<div class="bar">
<div class="percent">12,631</div>
<div class="bg" style="height: 100%"></div>
</div>
<label>Without Try Catch</label>
</li>
<li class="low-value">
<div class="bar">
<div class="percent">6,589</div>
<div class="bg" style="height: 52%"></div>
</div>
<label>With Try Catch</label>
</li>
</ul>
</div>
<!-- recycle your garbage -->
<div class="step js title" data-x="-1500" data-y="10500">
Recycle your garbage
</div>
<div class="step js example" data-x="0" data-y="10500">
<code>
<span class="comment">// Don't create instances for one off functions</span>
for( var i=0, length = arr.length; i < length; i++ ) {
( new Calculator() ).add( i, length );
}
<span class="comment">// Recycle objects</span>
for( var i=0; i < length; i++ ) {
sterni = new Bottle(); //instead Bottles.get();
sterni.fill();
sterni.drink();
sterni.destroy(); //instead sterni.recycle();
}
</code>
</div>
<div class="step js result" data-x="1500" data-y="10500">
<img height="100px" style="margin-bottom: 50px" src="images/gc-active.jpg">
<img height="100px" src="images/gc-inactive.jpg">
</div>
<!-- CSS composition vs render layer -->
<div class="step css title" data-x="3000" data-y="1500">
CSS composition vs Reflow
</div>
<div class="step css result" data-x="4500" data-y="1500">
<img src="images/full-render.jpg">
http://csstriggers.com/
</div>
<!-- Don't forget that css runs code too -->
<div class="step css title" data-x="3000" data-y="3000">
<div>Don't forget that css runs code too</div>
<a style="font-size: 20px" href="http://zunostudios.com/demos/css32014-demos/filters.html" target="_blank">CSS3 Effects CPU<a>
</div>
<div class="step css example" data-x="4500" data-y="3000">
<code>
<span class="comment">// This doesn't go down well in older IE's</span>
.class:hover {
//css rules
}
<span class="comment">// This leaked memory in versions of chrome</span>
.class {
background: linear-gradient( ... );
}
</code>
</div>
<!-- Batch DOM updates -->
<div class="step html title" data-x="7500" data-y="1500">
Batch DOM updates
</div>
<div class="step html example" data-x="9000" data-y="1500">
<code>
detachedElement = $( elementToModify ).detach();
mofifyElement( detachedElement );
parentElement.append( detachedElement );
</code>
</code>
</div>
<div class="step finished" data-x="4500" data-y="6000" data-z="12000">
<!--
http://jsperf.com/for-loop-vs-foreach-vs-foreach-shim/5
<br/>
https://developers.google.com/web/fundamentals/performance/rendering/stick-to-compositor-only-properties-and-manage-layer-count
<br/>
http://csstriggers.com/
-->
</div>
</div>
<script src="https://code.jquery.com/jquery-2.1.4.js"></script>
<script src="http://impress.github.io/impress.js/js/impress.js"></script>
<script>impress().init();</script>
</body>
</html>