./trace-deopt.sh http://localhost:4200
Wait until your page renders.
#!/usr/bin/env bash | |
set -Eeuo pipefail | |
trap cleanup SIGINT SIGTERM ERR EXIT | |
script_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd -P) | |
usage() { | |
cat <<EOF | |
Usage: $(basename "${BASH_SOURCE[0]}") [-h] [-v] [-f] -p param_value arg1 [arg2...] |
let cache = new Map(); | |
let pending = new Map(); | |
function fetchTextSync(url) { | |
if (cache.has(url)) { | |
return cache.get(url); | |
} | |
if (pending.has(url)) { | |
throw pending.get(url); | |
} |
var assert = require('assert'); | |
global.KEYS = JSON.parse(require('fs').readFileSync('bindings.json','utf8')); | |
global.RESULT = false; | |
global.CHARAT = function (key) { | |
var l = key.length; | |
return l > 7 && | |
key.charAt(l - 7) === 'B' && | |
key.charAt(l - 6) === 'i' && | |
key.charAt(l - 5) === 'n' && |
All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.
Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.
elem.offsetLeft
, elem.offsetTop
, elem.offsetWidth
, elem.offsetHeight
, elem.offsetParent
Consider the example:
var MyObject = Ember.Object.extend({
selectedContent: Ember.computed.filterBy('content', 'isSelected')
});
var obj = MyObject.create({
content: [
Em.Object.create({name: "one", isSelected: false}),
Em.Object.create({name: "two", isSelected: false})
Let this serve as a guide for anyone who'd like to dig into router.js's internals, understand what's going on, and hopefully contribute!
router.js
is most popularly known as the routing microlib used by the
Ember.js Router, though other folk have been known to use it beyond
Ember, including some Angular folk who weren't satisfied with
var empty, get, set, | |
__hasProp = {}.hasOwnProperty; | |
get = Ember.get; | |
set = Ember.set; | |
empty = function(obj) { | |
var key; | |
for (key in obj) { | |
if (!__hasProp.call(obj, key)) continue; |