On Github yanli0303 / web-performance-and-future
Yan (Peter) Li / Sep 2015
https://github.microstrategy.com/pages/yali/web-performance-and-future
View online
http://10.197.38.188/velocity/pdf
Download PDF
Hope it helps!
http://www.webperformancetoday.com/2012/04/02/mobile-versus-desktop-latency/ http://chimera.labs.oreilly.com/books/1230000000545/ch07.html#_brief_history_of_the_g_8217_s
What rules/best practices do you know?
Similar graph: http://www.w3.org/TR/navigation-timing/#processing-model
<meta http-equiv="refresh" content="5; url=http://example.com/">
window.location.reload(true); // document.location? window.location.replace("http://www.z.cn"); window.location.assign("http://www.z.cn"); window.location.href = "http://www.z.cn"; window.location = "http://www.z.cn"; window.history.forward(); window.history.back(); window.history.go(-1);
chrome://histograms/DNS.ResolveSuccess
<link rel="dns-prefetch" href="www.microstrategy.com">
Hint browser to pre-resolve these names
Supported: Chrome, Firefox, Safari, IE9+
Tuning initcwnd for optimum performance
Linux TCP/IP tuning for scalability (tcp_slow_start_after_idle)
Caching Tutorial by Mark Nottingham
Check your pages with REDbot
http://www.mobify.com/blog/domain-sharding-bad-news-mobile-performance/
<link rel="prefetch" href="next-page.css"> <link rel="subresource" href="critical.js">
http://www.smashingmagazine.com/2015/08/understanding-critical-css/
Alva Cheung
“Load non-critical features asynchronously”<link rel="prerender" href="http://www.microstrategy.com">
Initiate background pre-render of entire page
Supported: Chrome, Firefox
Why care?
Static Web Pages Interactive CSSHTMLJavaScript CSSJavaScriptHTMLSpeed up runtime method binding by remembering the results of a previous method lookup directly at the call site
function addTwoThings(thing1, thing2) { return thing1 + thing2; } addTwoThings(1, 2); addTwoThings(100, 200); /* fast */ addTwoThings('a', 'b'); /* slow */
function Dog(name) { this.name = name; } var dog1 = new Dog('Jim'); /* hidden class C1 */ var dog2 = new Dog('Bin'); /* hidden class C2 */ dog2.gender = 'male';
onresize, onscroll...etc
var $div = $('#content') var elements = ['a', 'b', 'c', 'd']; for(var i=0,l=elements.length; i<l; i++) { $div.append(elements[i]); }
var $div = $('#content') var elements = ['a', 'b', 'c', 'd']; for(var i=0,l=elements.length; i<l; i++) { // one line of evilness var a = $(window).scrollTop; $div.append(elements[i]); }
.class ul li a { color: blue; }
border-radius; box-shadow; transform,filter; :nth-child; position:fixed;
*; [disabled]; [type="text"]
GET / HTTP/1.1 Host: server.example.com Connection: Upgrade, HTTP2-Settings Upgrade: h2c HTTP2-Settings: <payload>
HTTP/1.1 200 OK Content-Length: 243 Content-Type: text/html ...
HTTP/1.1 101 Switching Protocols Connection: Upgrade Upgrade: h2c [ HTTP/2 connection ...
HTTP + SSL/TLS = HTTPS
Equally Important!
Dive deeper: YouTube - Is TLS Fast Yet?
<script src="//code.jquery.com/jquery-1.11.3.min.js"></script>
Strict-Transport-Security: max-age=10886400; includeSubDomains
Browser remembers (for specified max-age period) that it should automatically request HTTPS resources for this site and its subdomains.
HSTS eliminates HTTP --> HTTPS redirects.
Web Development Reading List: https://wdrl.info/
WeChat ID: peterleepersonal