and micro-libraries
first,
*restrictions apply (to every project ever)
value provided to developer, not end-user
**introduces tribal complexities instead
***if only there was already a platform...
end-user
http://whatdoesmysitecost.com/
According to the August 15, 2015 run of HTTP Archive, the average site now weighs 2169kb
https://developers.google.com/web/tools/profile-performance/evaluate-performance/rail?hl=en
The RAIL Performance Model
a user-centric performance model.
How much of your load budget does `${framework}` use?
Page Load Times -- One Page with:
no images / media, limited markup, just the core files of the following -- gzipped and minified
simulating 3G ~ 1MB/s, macbook pro, chrome
`${framework}` | load time -- no cache (% budget) |
load time -- cache (% budget) |
---|---|---|
jQuery | 364ms | 107ms |
Bootstrap JS | 143ms | 49ms |
Bootstrap CSS | 304ms | 77ms |
Bootstrap Glyphs | 135ms | 85ms |
Page | 747ms (74%) | 261ms (26%) |
`${framework}` | load time -- no cache (% budget) |
load time -- cache (% budget) |
---|---|---|
jQuery | 553ms | 65ms |
Bootstrap JS | 400ms | 69ms |
Bootstrap CSS | 400ms | 62ms |
Bootstrap Glyphs | 272ms | 50ms |
Angular Core | 733ms | 79ms |
Page | 847ms (85%) | 319ms (32%) |
Page Load Times -- One Page With:
no images / media, limited markup, just the core files of the following -- gzipped and minified
simulating 3G ~ 1MB/s, macbook pro, chrome
Browser (HTML, CSS, JavaScript, etc)
jQuery Core
jQuery Extensions
Bootstrap.JS
used code
bloat
Browser (HTML, CSS, JavaScript, etc)
Bootstrap Core CSS
Bootstrap Theme
used code
bloat
Browser (HTML, CSS, JavaScript, etc)
Angular Core
Angular Modules
used code
bloat
Browser (HTML, CSS, JavaScript, etc)
jQuery
jQ Plugin
jQ Plugin
jQ Plugin
jQ UI
Bootstrap JS
Angular
NG Module
NG Module
NG Module
NG Module
BS CSS
BS Theme
BS Glyphs
Browser (HTML, CSS, JavaScript, etc)
jQuery
jQ Plugin
jQ Plugin
jQ Plugin
jQ UI
Bootstrap JS
Angular
NG Module
NG Module
NG Module
NG Module
BS CSS
BS Theme
BS Glyphs
my-app.js
my-app.css
app assets
Content
Browser (HTML, CSS, JavaScript, etc)
my-app.js
my-app.css
app assets
Content
so, is this possible?
Browser (HTML, CSS, JavaScript, etc)
my-app.js
my-app.css
app assets
Content
Is
this
really that bad...
jQuery
jQ Plugin
jQ Plugin
jQ Plugin
jQ UI
Bootstrap JS
Angular
NG Module
NG Module
NG Module
NG Module
BS CSS
BS Theme
BS Glyphs
...that we have to put all this in between?
https://en.wikipedia.org/wiki/Usage_share_of_web_browsers
http://www.w3counter.com/globalstats.php?year=2015&month=8
freshness in TTRs (tm)
app lifecycle in days
dhtml
angular 1
polyfill
How fresh for an app released today (9/23/15)?
TTR: time 'til refactor
[imagine fancy chart]
https://en.wikipedia.org/wiki/Global_Internet_usage
statistically speaking
just like IRL budgets, getting ahead is mostly about discipline &
unfortunately
not lottery-winning
vs
but first:
https://ymnnf.app.lds.org/hands-on/polyfill/
https://ymnnf.app.lds.org/hands-on/polyfill/all.html
function polyfill(isNeeded, src) {
if(isNeeded) {
var script = document.createElement('script');
script.setAttribute('src', src);
document.head.appendChild(script);
}
}
polyfill(typeof window.CustomEvent !== "function", 'polyfills/customevent.min.js');
aka: execute when the DOM is ready but before window.load
document.addEventListener('DOMContentLoaded', someFunction);
https://ymnnf.app.lds.org/hands-on/query-selector/
https://ymnnf.app.lds.org/hands-on/query-selector-all/
IE6+
modern browsers & IE8+
https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelector
https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelectorAll
https://developer.mozilla.org/en-US/docs/Web/API/element
https://ymnnf.app.lds.org/hands-on/class-list/
IE8+
modern browsers & IE10+
https://developer.mozilla.org/en-US/docs/Web/API/Element/classList
jQuery's default behavior after $('.selector'). Also .each()
jQuery's .filter(), .is(), eq(), etc.
*
modern browsers & IE9+
https://ymnnf.app.lds.org/hands-on/item-visibility/
modern browsers & IE10+
IE8+
https://ymnnf.app.lds.org/hands-on/custom-event/
modern browsers
IE9+ with Polyfill*
IE9+
https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent/CustomEvent
All & IE9+
https://github.com/jakearchibald/es6-promise
* with a little more effort, can be polyfilled further back as well
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign
http://youmightnotneedjquery.com/
http://youmightnotneedjqueryplugins.com/
http://microjs.com/#
Vanilla vs NG?