forked from estelle/mobilecss
-
Notifications
You must be signed in to change notification settings - Fork 0
/
45.html
1134 lines (904 loc) · 38.1 KB
/
45.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
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!doctype HTML>
<html>
<head>
<meta charset="utf-8" />
<title>CSS3 & Mobile Performance</title>
<link href="mobilecss.css" rel="stylesheet" media="projection, screen">
<style>
//.slide {outline: solid;}
#largegradient:hover {
background-image:url(images/hugegradient.jpg);
background-position: -125px -26px;
}
/* transition with and wirhtout reflow */
.fcode {
color: black;
font-size: 1.6rem;
background-color: rgba(255,255,255,0.4);
-webkit-transition: all 2s ease-in 50ms;
-moz-transition: all 2s ease-in 50ms;
-ms-transition: all 2s ease-in 50ms;
-o-transition: all 2s ease-in 50ms;
transition: all 2s ease-in 50ms;
border:2px solid;
}
.big {font-size: 2.2rem;}
.fcode:hover {
color: red;
background-color: rgba(255,255,255,0.9);
}
.fcode:not(.fcode2):hover {
font-size: 2.2rem;
}
.fcode2:hover {
-webkit-transform: scale(1.4);
-webkit-transform-origin: top left;
-moz-transform: scale(1.4);
-moz-transform-origin: top left;
-ms-transform: scale(1.4);
-ms-transform-origin: top left;
-o-transform: scale(1.4);
-o-transform-origin: top left;
transform: scale(1.4);
transform-origin: top left;
}
.compact li, .compact ul {
margin-top: 0.3em;
margin-bottom: 0;
}
body > header {overflow: visible;}
.expired {
-webkit-transform: rotate(-13deg);
font-size: 8rem;
width: 40rem;
border:10px dashed;
margin: 100px auto;
text-align: center;
color: #600;
}
</style>
</head>
<body>
<header>
<nav>
<ul>
<li class="button cancel" id="back">Back</li>
<li class="button done" id="next">Next</li>
</ul>
<h1>Web performance in a mobile world</h1>
</nav>
</header>
<div id="presentation">
<div id="presentation-counter"></div>
<div id="slides">
<!-- Title Slide -->
<div class="slide normal">
<header>
</header>
<section>
<h1 style="font-size: 4rem; color: #E65F00" >Web Performance Considerations in a<br/> Mobile World</h1>
<div style="float:left; -webkit-transform:scale(0.75); -webkit-transform-origin: 0 0;"><img src="http://akamaicovers.oreilly.com/images/9780980846904/cat.gif" alt="HTML5 and CSS3 for the Real World" style="float: left;"><img src="http://akamaicovers.oreilly.com/images/0636920018063/cat.gif" alt="HTML5: The Definitive Guide" style="margin: 0 20px; float:right;"/><br/><img src="http://akamaicovers.oreilly.com/images/0636920021711/cat.gif" alt="MObile HTML5" style="margin: 0 20px 0 0; clear:left"/><img src="http://akamaicovers.oreilly.com/images/0636920025955/cat.gif" alt="Web Performance Daybook"/></div>
<div style="float: right; margin-top: 100px;">Slides: <a href="http://estelle.github.io/mobilcss/45.html">estelle.github.io/mobilecss/45.html</a><br/>
Name: Estelle Weyl
<br>Blog: <a href="http://standardista.com">standardista.com</a>
<br>Twitter: <a href="http://twitter.com/estellevw">@estellevw</a></p>
</div>
</section>
</div>
<div class="slide">
<header><h1>Disclaimer</h1></header>
<section class="content">
<div class="expired temphidden">EXPIRED</div>
</section>
</div>
<!-- Fast -->
<div class="slide normal">
<header>
<h1>Fast to ....</h1>
</header>
<section style="height:550px">
<ul style="font-size: 4rem;">
<li style="margin-left: 100px;">Load</li>
<li style="margin-left: 150px;">Render</li>
<li style="margin-left: 200px;">Respond</li>
<li style="margin-left: 250px;">Understand</li>
</ul>
<ul class="temphidden">
<li class="notes">Beautiful</li>
<li class="notes">Useful</li>
<li class="notes">Eco-friendly</li>
</ul>
</section>
</div>
<!--YSLOW -->
<div class="slide normal">
<header>
<h1>YSLOW</h1>
</header>
<section>
<ul class="visibility">
<li>Make fewer HTTP requests
<p class="hidenotes">Decreasing the number of components on a page reduces the number of HTTP requests required to render the page, resulting in faster page loads. Some ways to reduce the number of components include: combine files, combine multiple scripts into one script, combine multiple CSS files into one style sheet, and use CSS Sprites and image maps.</p></li>
<li>Avoid empty src or href
<p class="hidenotes">You may expect a browser to do nothing when it encounters an empty image src. However, it is not the case in most browsers. IE makes a request to the directory in which the page is located; Safari, Chrome, Firefox 3 and earlier make a request to the actual page itself. This behavior could possibly corrupt user data, waste server computing cycles generating a page that will never be viewed, and in the worst case, cripple your servers by sending a large amount of unexpected traffic.</p></li>
<li>Compress components with gzip
<p class="hidenotes">Compression reduces response times by reducing the size of the HTTP response. Gzip is the most popular and effective compression method currently available and generally reduces the response size by about 70%. Approximately 90% of today's Internet traffic travels through browsers that claim to support gzip.</p></li>
<li>Put CSS at top
<p class="hidenotes">Moving style sheets to the document HEAD element helps pages appear to load quicker since this allows pages to render progressively.</p></li>
<li>Put JavaScript at bottom
<p class="hidenotes">JavaScript scripts block parallel downloads; that is, when a script is downloading, the browser will not start any other downloads. To help the page load faster, move scripts to the bottom of the page if they are deferrable.</p></li>
<li>Avoid CSS expressions
<p class="hidenotes">CSS expressions (supported in IE beginning with Version 5) are a powerful, and dangerous, way to dynamically set CSS properties. These expressions are evaluated frequently: when the page is rendered and resized, when the page is scrolled, and even when the user moves the mouse over the page. These frequent evaluations degrade the user experience.
</p></li>
<li>Reduce DNS lookups
<p class="hidenotes">The Domain Name System (DNS) maps hostnames to IP addresses, just like phonebooks map people's names to their phone numbers. When you type URL www.yahoo.com into the browser, the browser contacts a DNS resolver that returns the server's IP address. DNS has a cost; typically it takes 20 to 120 milliseconds for it to look up the IP address for a hostname. The browser cannot download anything from the host until the lookup completes.
</p></li>
<li>Minify JavaScript and CSS
<p class="hidenotes">
Minification removes unnecessary characters from a file to reduce its size, thereby improving load times. When a file is minified, comments and unneeded white space characters (space, newline, and tab) are removed. This improves response time since the size of the download files is reduced.
</p></li>
<li>Avoid URL redirects
<p class="hidenotes">
URL redirects are made using HTTP status codes 301 and 302. They tell the browser to go to another location. Inserting a redirect between the user and the final HTML document delays everything on the page since nothing on the page can be rendered and no components can be downloaded until the HTML document arrives.
</p></li>
<li>Remove duplicate JavaScript and CSS
<p class="hidenotes">
Duplicate JavaScript and CSS files hurt performance by creating unnecessary HTTP requests (IE only) and wasted JavaScript execution (IE and Firefox). In IE, if an external script is included twice and is not cacheable, it generates two HTTP requests during page loading. Even if the script is cacheable, extra HTTP requests occur when the user reloads the page. In both IE and Firefox, duplicate JavaScript scripts cause wasted time evaluating the same scripts more than once. This redundant script execution happens regardless of whether the script is cacheable.
</p></li>
<li> Reduce the number of DOM elements
<p class="hidenotes">
A complex page means more bytes to download, and it also means slower DOM access in JavaScript. Reduce the number of DOM elements on the page to improve performance.</p>
</li>
<li>Avoid HTTP 404 (Not Found) error
<p class="hidenotes">Making an HTTP request and receiving a 404 (Not Found) error is expensive and degrades the user experience. Some sites have helpful 404 messages (for example, "Did you mean ...?"), which may assist the user, but server resources are still wasted.</p></li>
<li> Avoid AlphaImageLoader filter
<p class="hidenotes">The IE-proprietary AlphaImageLoader filter attempts to fix a problem with semi-transparent true color PNG files in IE versions less than Version 7. However, this filter blocks rendering and freezes the browser while the image is being downloaded. Additionally, it increases memory consumption. The problem is further multiplied because it is applied per element, not per image.
</p>
</li>
<li>Do not scale images in HTML
<p class="hidenotes">Web page designers sometimes set image dimensions by using the width and height attributes of the HTML image element. Avoid doing this since it can result in images being larger than needed. For example, if your page requires image myimg.jpg which has dimensions 240x720 but displays it with dimensions 120x360 using the width and height attributes, then the browser will download an image that is larger than necessary.</p></li>
<li>Make favicon small and cacheable
<p class="hidenotes">A favicon is an icon associated with a web page; this icon resides in the favicon.ico file in the server's root. Since the browser requests this file, it needs to be present; if it is missing, the browser returns a 404 error (see "Avoid HTTP 404 (Not Found) error" above). Since favicon.ico resides in the server's root, each time the browser requests this file, the cookies for the server's root are sent. Making the favicon small and reducing the cookie size for the server's root cookies improves performance for retrieving the favicon. Making favicon.ico cacheable avoids frequent requests for it.
</p>
</li>
</ul>
<footer>Click item for more info. Link: <a href="http://developer.yahoo.com/yslow/">YSlow</a></footer>
</section>
</div>
<!-- Page Speed -->
<div class="slide normal">
<header>
<h1>Page Speed </h1>
</header>
<section class="content columns">
<ul>
<li>Leverage browser caching</li>
<li>Enable compression</li>
<li>Defer parsing of JavaScript</li>
<li>Minimize request size</li>
<li>Specify a cache validator</li>
<li>Optimize images</li>
<li>Minify JavaScript</li>
<li>Minify HTML</li>
<li>Specify image dimensions</li>
<li>Specify a character set</li>
<li>Specify a Vary: Accept-Encoding header</li>
<li>Reduce request serialization</li>
<li>Eliminate unnecessary reflows</li>
<li>Avoid long-running scripts</li>
<li>Avoid CSS @import</li>
<li>Avoid bad requests</li>
<li>Enable Keep-Alive</li>
<li>Make landing page redirects cacheable</li>
<li>Minify CSS</li>
<li>Minimize redirects</li>
<li>Optimize the order of styles and scripts</li>
<li>Put CSS in the document head</li>
<li>Remove query strings from static resources</li>
<li>Serve resources from a consistent URL</li>
<li>Serve scaled images</li>
</ul>
<footer><a href="http://code.google.com/speed/page-speed/">Google Page Speed Tools</a></footer>
</section>
</div
><!-- Table of Contents -->
<div class="slide normal" style="background-image:url(images_old/telephonecans.jpg); background-position:80% bottom; background-repeat:no-repeat;">
<header>
<h1>Device limitations!</h1>
</header>
<section>
<ul class="sevenless" style="margin-bottom: 4rem">
<li>UI responsiveness</li>
<li>Battery Life</li>
<li>Latency</li>
<li>Memory</li>
<li>Plethora of Screen Sizes</li>
</ul>
<h2>Phones aren't Laptops</h2>
<h2>More powerful browsers. <br/>Less powerful CPUs</h2>
</section>
</div>
<div class="slide intro">
<header><h1>UI Responsiveness</h1></header>
<section class="content">
</section>
</div>
<!-- touch events -->
<div class="slide normal" style="background-image:url(images/gestures.gif); background-size:80%; background-position: 50% 90%">
<header>
<h1>UI responsiveness - Touch Events</h1>
</header>
<section>
<div style="background-image:url(images/touch.gif), url(images/thumbup.jpg), url(images/butler.jpg); background-color:rgba(255,255,255,0.85); background-position: 5% bottom, 45% 95%, 95% 98%; width: 70%; margin: auto; padding: 20px; padding-bottom: 100px; min-height: 100px; border: solid #ccc; border-radius: 15px;">
<ul class="sevenless">
<li>Touch Event: 300 - 500ms delay</li>
<li>Extra touches aren't forgotten</li>
<li>Co-opt with touch events with JS
<ol>
<li>Accept input</li>
<li>Provide user feedback</li>
<li>Update the UI</li>
</ol>
</li>
</ul>
</div>
<footer>Credit: <a href="http://www.lukew.com/touch/TouchGestureGuide.pdf">Luke W.</a></footer>
</section>
</div>
<div class="slide normal">
<header><h1>Viewport</h1></header>
<section class="content">
<pre contenteditable=""><meta name="<strong>viewport</strong>" content="<strong>width</strong>=device-width,
<strong>initial-scale</strong>=1, <strong>maximum-scale</strong>=1"/></pre>
<dl class="deprecated">
<dt>width</dt>
<dd>Size of the viewport in number of pixels or <code>device-width</code> (width of screen)</dd><dd>
</dd><dt>height</dt>
<dd>Height of the viewport in number of pixels or <code>device-height</code> (height of screen)</dd><dd>
</dd><dt>initial-scale
</dt><dd>zoom level when page is first loaded</dd>
<dt>maximum-scale</dt>
<dt>minimum-scale</dt>
<dt>user-scalable</dt>
<dd>Are users allowed to zoom the page</dd>
</dl>
<pre contenteditable="">@viewport {
width: device-width; zoom: 0.5;
}</pre>
<dl class="deprecated">
<dt>min-width</dt>
<dd>‘auto’, ‘device-width’, ‘device-height’, an absolute length, or a percentage as specified</dd>
<dt>max-width</dt>
<dd>‘auto’, ‘device-width’, ‘device-height’, an absolute length, or a percentage as specified</dd>
<dt>width</dt>
<dt>min-height</dt>
<dd>‘auto’, ‘device-width’, ‘device-height’, an absolute length, or a percentage as specified</dd>
<dt>max-height</dt>
<dd>‘auto’, ‘device-width’, ‘device-height’, an absolute length, or a percentage as specified</dd>
<dt>height</dt>
<dt>zoom</dt>
<dd>auto, positive number or percentage</dd>
<dt>min-zoom</dt>
<dd>Minimum zoom factor allowed. auto, positive number or percentage</dd>
<dt>max-zoom</dt>
<dd>Maximum zoom factor allowed. auto, positive number or percentage</dd>
<dt>user-zoom</dt>
<dd>zoom or fixed. User can or can't zoom in/out.</dd>
<dt>orientation</dt>
<dd>auto, portrait or landscape.</dd>
</dl>
<p>If <meta> is set to disable zoom, in Chrome and Firefox there is no delay on onClick events.</p>
</section>
<span class="counter">13</span></div>
<!-- BATTERY -->
<div class="slide normal">
<header><h1>Batteries</h1>
</header>
<section style="background-image:url(images/carbattery.jpeg) , url(images/battery.jpg); background-position: bottom left, 80% 90%; background-size: auto, 130px;height:600px;">
</section>
</div>
<!-- BATTERY -->
<div class="slide normal">
<header>
<h1>Battery: Solutions</h1>
</header>
<section>
<p>CPU Drains the battery. Avoid using it!</p>
<ul class="sevenless">
<li>Use JPEG over PNG, and PNG8 over GIF</li>
<li>Minimize the DOM</li>
<li>Avoid reflows and repaints</li>
<li>Minimize JavaScript (size and activity)</li>
<li>No JavaScript animations</li>
<li>Do you really need library/framework?</li>
<li>Use darker colors if you can <span style="opacity: 0.5">AMOLED</span></li>
</ul>
</section>
<footer>Don'e use Gifs!!!! Resource: <a href="http://www2012.org/proceedings/proceedings/p41.pdf">Who killed my battery - PDF</a></footer>
</div>
<div class="slide normal">
<header><h1>More on Images</h1></header>
<section class="content">
<h2>Use background images, instead of foreground images.</h2>
<p>Background images are first rendered with image data send to Core Animation. Safari doesn't render <img> first. The decoded image file is sent, as is, pre-rendered, to the Core Animation as a new layer. Foreground images is sent to Core Animation as image data which it has to keep in graphics memory. This uses more memory.</p>
<ul class="sevenless">
<li>JPEGs perform better than GIFs and PNGs</li>
<li>Images ⇒ energy consumption</li>
<li>Rendering energy is proportional to # and size of images.</li>
</ul>
</section>
</div>
<div class="slide normal">
<header><h1>More on JavaScript</h1></header>
<section class="content">
<ul class="sevenless">
<li> JS (and CSS) can be as expensive to render as images</li>
<li>Dynamic JS (like XMLHttpRequest) increase rendering cost (can't be cached). </li>
<li>JS (download, parsing & executing) can be biggest energy consumer
</li>
<li>All scripts loaded and parsed (even if not used)</li>
<li>Minimize JS to what's needed. Is library necessary?
<ul>
<li>Include only functions used by page</li>
<li>Goal of libs is to equalize browsers: not necessry on mobile</li>
<li>Libraries my simplify web
development, but increase energy use. (<a href="http://estelle.github.com/jsframeworks">My framework talk</a>).</li></ul></li></ul>
</section>
</div>
<!-- TERM: Latency -->
<div class="slide intro" style="background:url(images/latencykills.jpg) bottom center no-repeat #ffffff;">
<header>
<h1>Latency</h1>
</header>
<section>
<footer class="credit">Photo: <a href="http://www.flickr.com/photos/tby/1472668838/">T Bryce Yehl</a></footer>
</section>
</div>
<!-- Normal DNS -->
<div class="slide normal">
<header>
<h1>Latency</h1>
<h2 style="text-align:center; font-size: 1.8rem;">Reduce the number of DNS lookups and HTTP Requests </h2>
</header>
<section>
<img src="images/simpledns.gif" style="margin: 40px auto; display: block" alt="Computer asks DNS server for IP address, then goes to IP to get website" />
<p style="text-align:center; position:absolute; bottom: 40px; width: 100%;">Each host is a different lookup!!</p>
</section>
</div>
<!-- Mobile DNS -->
<div class="slide normal">
<header>
<h1>Latency</h1>
</header>
<section>
<img src="images/latency.gif" style="margin: 40px auto" alt="Computer asks DNS server for IP address, then goes to IP to get website" />
<ul>
<li></li>
</ul>
</section>
</div>
<div class="slide">
<header>
<h1>Latendy: Solution</h1></header>
<section class="content">
<p>Issue: Requests take longer to complete</p>
<ul class="sevenless">
<li>Reducing the number of DNS look up</li>
<li>Reduce the number of HTTP requests</li>
<li>Don't redirect</li>
<li>Use Data URIs</li>
<li>Use Sprites (not too big - memory issues!!!)</li>
<li>Levarage localStorage</li>
</ul>
</section>
</div>
<div class="slide intro">
<header><h1>Reduce Requests</h1><h2>Sprites</h2></header>
<section class="content">
<img src="images/sprite.jpg" alt="Favicon Image Sprite"/style="margin: 200px;">
</section>
</div>
<div class="slide normal">
<header><h1>Best Practices (for desktop)</h1></header>
<section class="content">
<pre contenteditable style="font-size: 1.4rem;"><!DOCTYPE HTML>
<html>
<head>
<meta charset="UTF-8">
<title>Titles are good for SEO</title>
<strong><link rel="stylesheet" href="prettyWhenItLoads.<strong>css</strong>"/></strong>
</head>
<body>
<!-- lots of good content -->
<strong> <script src="dontBlockHTMLandCSS.<strong>js</strong>"></script></strong>
</body>
</html></pre>
</section>
</div>
<div class="slide normal">
<header><h1>Reduce HTTP requests</h1></header>
<section class="content">
<pre contenteditable style="font-size: 1.4rem;"><!DOCTYPE HTML>
<html>
<head>
<meta charset="UTF-8">
<title>Titles are good for SEO</title>
<strong><style id="keyword">
/* lots of styles */
</style></strong>
</head>
<body>
<!-- lots of good content -->
<strong><script id="otherKey">
/* JS that makes site work
</script></strong>
<span class="temphidden em"><img src="images/bingkb.gif" class="temphidden" style="float: right; position:relative; top: -200px;"/><strong><script>
/* localStorage & cookies script*/
</script></strong></span>
</body>
</html></pre>
</section>
</div>
<div class="slide intro">
<header><h1>Leverage Local Storage</h2></header>
<section class="content">
</section>
</div>
<!-- TERM: Memory -->
<div class="slide intro black" style="background-image:url(images/memory.gif); background-color: black; background-position: bottom;">
<header>
<h1 style="color: white;">Memory</h1>
</header>
<section style="padding-top: 230px;color: white;">
<p class="temphidden">High memory usage causes a slow UI</p>
<p class="temphidden" style="margin: 1.4rem 0">When you are out of memory, you are out of memory</p>
<p class="temphidden">Browser crashes to free up memory</p>
</section>
</div>
<!-- Device Memory: CPU comparison -->
<div class="slide normal">
<header><h1>Memory</h1></header>
<section>
<table class="rowed">
<thead>
<tr>
<th>Device</th>
<th>Memory</th>
</tr>
</thead>
<tbody>
<tr>
<td>iPhone 3G</td>
<td>128MB</td>
</tr>
<tr>
<td>iPhone 3GS</td>
<td>256 MB</td>
</tr>
<tr>
<td>HTC Inspire</td>
<td>768 MB</td>
</tr>
<tr>
<td>Galaxy Nexus </td>
<td>1024 MB</td>
</tr>
<tr>
<td>iPad 1</td>
<td>256 MB</td>
</tr>
<tr>
<td>iPod Touch (4) </td>
<td>256 MB</td>
</tr>
<tr>
<td>iPad 3 </td>
<td>1024 MB</td>
</tr>
<tr>
<td>iPad Mini</td>
<td>512 MB</td>
</tr>
<tr>
<td>MacBook Pro</td>
<td>16 GB</td>
</tr>
</tbody>
</table>
<p style="margin: 1.4rem 0"><strong>Mobile Norm:</strong> 512MB of RAM, with 1GHz Processor<br/><strong style="opacity: 0;">Mobile Norm:</strong> Moving toward 1GB RAM</p>
<p style="text-align: center;">Developing without mobile in mind<br/>
leads to sloppy App Dev</p>
</section>
</div>
<!-- HTC Inspire: How much CPU is used without anything running-->
<div class="slide normal">
<header><h1>Browser shares Memory</h1></header>
<section>
<table class="htc">
<thead><tr><td colspan="3">Running Services</td></tr></thead>
<tfoot><tr><td style="background-color:#FCC">Other</td><td colspan="2" style="background-color:#6C9">73MB Avail: 255MB + 182MB in 21</td></tr></tfoot>
<tbody>
<tr><td colspan="2">Calendar</td><td>8.4MB</td></tr>
<tr><td colspan="3">Process:com.htc.bgp</td></tr>
<tr><td rowspan="2"></td><td>ObexService</td><td>31:52:14</td></tr>
<tr><td colspan="2">Started by application: Touch to stop</td></tr>
<tr><td colspan="2">AT&T Navigator</td><td>8.4MB</td></tr>
<tr><td colspan="3">Process: com.telnav.app.android.congular</td></tr>
<tr><td rowspan="2"></td><td>ResoucePreLoader</td><td>Restarting</td></tr>
<tr><td colspan="2">Started by application: Touch to stop</td></tr>
<tr><td colspan="2">AT&T Spots</td><td>2.4MB</td></tr>
<tr><td colspan="3">Process: com.matchboxmobile.wasp</td></tr>
<tr><td rowspan="2"></td><td>WispService</td><td>31:52:14</td></tr>
<tr><td colspan="2">Started by application: Touch to stop</td></tr>
<tr><td colspan="2">Media</td><td>4.1MB</td></tr>
<tr><td colspan="3">Process: android.process.media</td></tr>
<tr><td rowspan="2"></td><td>DownloadService</td><td>31:52:14</td></tr>
<tr><td colspan="2">Started by application: Touch to stop</td></tr>
<tr><td colspan="2">PVWmdrmService</td><td>2.2MB</td></tr>
<tr><td colspan="3">Process: com.pv.wmdrmservice</td></tr>
<tr><td rowspan="2"></td><td>PVWmdrmService</td><td>31:52:14</td></tr>
<tr><td colspan="2">Started by application: Touch to stop</td></tr>
</tbody>
</table>
</section>
</div>
<!--GZip does not suffice -->
<div class="slide normal">
<header>
<h1>Not enough to <big>GZip</big></h1>
</header>
<section class="big">
<p style="margin: 0 -20px;"><img src="images/gzipbig.png" alt="" style="vertical-align:middle">
<img src="images/arrow.png" alt="" style="vertical-align:middle">
<img src="images/gzipsmall.jpg" alt="" style="vertical-align:middle">
<img src="images/arrow.png" alt="" style="vertical-align:middle">
<img src="images/gzipbig.png" alt="" style="vertical-align:middle"></p>
<p style="text-align:center;" class="em">Rendered media are still the same size.</p>
</section>
</div>
<!-- Reduce File Size - ImageAlpha -->
<div class="slide normal">
<header>
<h1>Images & Memory: Solutions</h1>
</header>
</header>
<section style="background:url(images/tinySrc.jpg) top right no-repeat; min-height:500px; padding:20px;">
<ul class="sevenless compact" style="background-color: rgba(0,0,0,0.3); color: white; float: left; list-style-position:none;">
<li>Reduce file size
<ul>
<li>Use tools (ImageAlpha, TinyPNG)</li>
<li>Use PNG8</li>
</ul>
</li>
<li>Reduce image size</li>
<li>Serve the right image
<ul>
<li>Use Media Queries</li>
<li>Use tools (http://src.sencha.io/http://myimage)</li>
<li><picture></li>
<li>srcset attribute</li>
<li>Clown Car Technique</li>
<li>Use fonts when you can</li>
</ul>
</li>
</ul>
<p> Video, Audio, Images and Text can be compressed to save bandwidth, but they're uncompressed in the browser.</p>
<footer class="credit">Photo: <a href="http://www.hdwallpapers4ipad.com/photo/abstract_backgrounds/broken_screen/2-0-1568">hdwallpapers4ipad.com</a></footer>
</section>
</div>
<!-- media queries -->
<div class="slide" style="background-image: url(images/devicesizes.jpg); background-position:bottom;" >
<header><h1>Varied Screen Sizes</h1></header>
<section class="content">
<ul style="margin-top: 270px; font-size:1.1em">
<li>Wrist Watch</li>
<li>Smart Phone</li>
<li>Tablet</li>
<li>Laptop</li>
<li>Monitor</li>
<li>TV</li>
<li></li>
<li>portrait v. landscape?</li>
<li>high and low resolution?</li>
</ul>
</section>
</div>
<!-- media queries: browser support -->
<div class="slide normal">
<header><h1>Screen Size Solution: media queries</h1></header>
<section class="content">
<pre contenteditable style="font-size: 100%;"><link rel='stylesheet'
<b>media='screen and (min-width: 320px) and (max-width: 480px)'</b><br/>href='css/smartphone.css' /></pre>
<pre contenteditable style="font-size: 110%;"><b>@media screen and (max-width: 480px)</b>{
body {
background-image: url(small/bgimage.jpg);
}
}
<b>@media screen and (min-width: 481px) and (max-width: 960px)</b>{
body {
background-image: url(medium/bgimage.jpg);
}
}
<b>@media screen and (min-width: 481px) and (max-width: 960px),
screen and (min-width: 380px) and (min-resolution: 130dpi),
screen and (min-width: 380px) and (-webkit-min-device-pixel-ratio: 2)</b>{
body {
background-image: url(large/bgimage.jpg);
}
} </pre>
</div>
<!-- media queries: v 3 -->
<div class="slide normal">
<header><h1>Resource: What can you query</h1></header>
<section class="content"><ul>
<li><em>(min/max)-width:</em> viewport width</li>
<li><em>(min/max)-height:</em> viewport height</li>
<li><em>(min/max)-device-width:</em> screen width</li>
<li><em>(min/max)-device-height:</em> screen height</li>
<li><em>orientation:</em> portrait(h>w) | landscape(w>h)</li>
<li><em>(min/max)-aspect-ratio:</em> width/height</li>
<li><em>(min/max)-device-aspect-ratio:</em> device-width/height</li>
<li><em>(min/max)-resolution:</em> 72dpi | 100dpcm</li>
</ul>
<ul class="content" style="opacity: 0.3">
<li><em>(min/max)-color:</em> </li>
<li><em>(min/max)-color-index:</em> </li>
<li><em>(min/max)-monochrome:</em> 0 | 1+</li>
<li><em>scan:</em> progressive | interlace (tv) </li>
<li><em>grid:</em> 0 | 1 (grids (like tty) or bitmap)</li>
<li>See <a href="http://www.w3.org/TR/css3-mediaqueries/#media1">Media Queries Spec</a></li>
</ul>
</section>
</div>
<!-- SVG Media Queries -->
<div class="slide">
<header><h1>Media Queries + SVG</h1></header>
<section>
<object data="http://estelle.github.io/clowncar/local.svg" style="float: right;"></object>
<pre>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 300 329" preserveAspectRatio="xMidYMid meet">
<title>Clown Car Technique</title>
<style>
svg {
background-size: 100% 100%;
background-repeat: no-repeat;
}
@media screen and (max-width: 400px) {
svg {background-image: url(images/small.png");}
}
@media screen and (min-width: 401px) and (max-width: 700px) {
svg {background-image: url(images/medium.png);}
}
@media screen and (min-width: 701px) and (max-width: 1000px) {
svg {background-image: url(images/big.png);}
}
@media screen and (min-width: 1001px) {
svg {background-image: url(images/huge.png);}
}
</style>
</svg></pre>
</section>
</div>
<!-- SVG Media Queries -->
<div class="slide object">
<object data="http://estelle.github.io/clowncar/"></object>
<a href="http://estelle.github.io/clowncar/" class="objectlink" target="play">Play</a>
</div>
<!-- SVG Media Queries -->
<!-- SVG Media Queries -->
<div class="slide object">
<header style="top: 120px;"><h1>Clown Car Technique with Object</h1></header>
<object data="http://estelle.github.io/clowncar/index.html"></object>
<a href="http://estelle.github.io/clowncar/index.html" class="objectlink" target="play">Play</a>
</div>
<!-- SVG Media Queries -->
<div class="slide object">
<header style="top: 120px;"><h1>Object with 1 http request</h1></header>
<object data="http://estelle.github.io/clowncar/singlereques.html"></object>
<a href="http://estelle.github.io/clowncar/singlereques.html" class="objectlink" target="play">Play</a>
</div>
<!-- Reduce File Size - JPG not PNG, with Masking -->
<div class="slide normal">
<header>
<h1>CSS Masking</h1>
</header>
<section>
<p class="onehundred">
<img src="images/frame.jpg" alt="jpeg" width="160">
<img src="images/plus.gif" alt="plus" width="100">
<img src="images/framemask.png" alt="framemask" width="160">
<img src="images/lessthan.gif" alt="less than" width="100">
<img src="images/frame2.png" alt="transparent png" width="160"><br>
<span style="width: 160px;">88KB</span>
<span style="width: 100px;"> + </span>
<span style="width: 160px;"> 4KB </span>
<span style="width: 100px;"> < </span>
<span style="width: 160px;"> 551KB</span>
</p>
<pre contenteditable>div {
background-image:url(images/frame.jpg);
-webkit-mask: url(images/framemask.png);
}</pre>
</section>
</div>
<div class="slide object">
<object data="mask.html"></object>
<header><h1>Masking example</h1></header>
<a href="mask.html" class="objectlink" target="_foo">Open</a>
</div>
<!-- CSS3 Options -->
<div class="slide normal">
<header>
<h1>Is CSS3 the Solution?</h1>
</header>
<section>
<div style="float: left; width: 50%">
<ul class="sevenless">
<li>rounded Corners</li>
<li>box-shadow</li>
<li>text-shadow</li>
<li>background-position</li>
<li>background-repeat</li>
<li>multiple background images</li>
<li>border-image</li>
<li>gradients</li>
<li>@media queries</li>
</ul>
</div>
<div style="float: left; width: 50%">
<h2>Benefits</h2>
<ul class="sevenless">
<li>Fewer HTTP Requests</li>
<li>Updatable</li>
<li>Scalable</li>
<li>Transitionable</li>
<li>Animatable</li>
<li>Fewer DOM Nodes</li>
</ul>
</div>
</section>
</div>
<!-- List of CSS properties that risk slowing you down -->
<div class="slide normal" style="background-image:url(images/bugsbunny.jpg); background-size:cover">
<header>
<h1>CSS3 <span style="-webkit-text-stroke: #fff 1px;">ISN'T</span> always the Solution!</h1>
<h2 style="font-size: 40px">UI Features can ruin your web app</h2>
</header>
<section>
<ul class="big whitened" >
<li>Enlarged Fonts</li>
<li>Box Shadow (inset)</li>
<li>Text Indent</li>
<li>Gradients</li>
<li>background-size: cover</li>
<li>Sprites (of large images)</li>
<li>‘Non-rendered’ content</li>
<li>Recalculating / Repainting the UI</li>
</ul> <p style="font-weight:700; clear:both; ">Static images may render faster than CSS effects</p>
<footer class="credit">Disney: "The Tortoise and The Hare"</footer>
</section>
</div>
<div class="slide object">
<object data="http://www.fontsquirrel.com/fontface/generator"></object>
<header><h1>Large and Small Fonts</h1></header>
<a href="http://www.fontsquirrel.com/fontface/generator" class="objectlink" target="_foo">www.fontsquirrel.com</a>
</div>
<div class="slide object">
<object data="http://copypastecharacter.com"></object>
<header><h1>Use icons, not images or external fonts</h1></header>
<a href="http://copypastecharacter.com" class="objectlink" target="_foo">Open it!</a>
</div>
<!-- Shadows -->
<div class="slide normal" style="background-image: url(images/insetshadow.jpg); background-size: 70%; background-position:50% 87%">
<header>
<h1>Alpha transparent effects</h1>
</header>
<section>
<ul class="big">
<li>Not rendered as static bitmap</li>
<li>Evaluated each repaint</li>
</ul>
<footer>Render order: rendered from back to front</footer>
</section>
</div>
<!-- Gradients -->
<div class="slide normal" id="largegradient">
<header>
<h1>Large Gradients</h1>
</header>
<section>
<ul class="big" style="width: 550px"><img src="images/iphonered.png" alt="iphone with large gradient" style="position: absolute; top: 70px; left: 586px"/>
<li>Keep gradients small</li>
<li>Requires CPU to create</li>
<li>Stored in memory</li>
<li>Memory: Radial > Linear </li>
<li>Render Speed: <br>
Images often faster than Gradients</li>
</ul>
</section>
</div>
<!-- font transition example -->
<div class="slide">
<header><h1>transitions</h1></header>
<section class="content">
<pre contenteditable class="fcode">code {
color: black;
font-size: 1.6rem;
background-color: rgba(255,255,255,0.9);
transition: all 2s ease-in 50ms;
}
code:hover {
color: red;
font-size: 2.2rem;