Ember.js
And benchmarks for all
Alex navasardyan
@twokul
hire us!
IT all started with
COMPOSABLE COMPUTED PROPERTIES
Example
var Person = Ember.Object.extend({
napTime: and(
equal('state', 'sleepy'),
not('thirsty'),
not('hungry')
)
});
var Alex = Person.create({
state: 'sleepy',
thirsty: true,
hungry: false
});
Alex.get('napTime'); // => false
did we mess something uP?
probably
How do we verify it?
BENCHMARKS
BENChmark
is a way to measure things
(what is the unit of measure?)
Pattern a
var totalTime, start = new Date, iterations = 6;
while (iterations--) { // Code snippet goes here }
// the number of milliseconds it took to execute the code snippet 6 times
totalTime = new Date - start;
Pattern b
var hz, period, startTime = new Date, runs = 0;
do { // Code snippet goes here runs++; totalTime = new Date - startTime; } while (totalTime < 1000);
// the number of operations per second hz = (runs * 1000) / totalTime;
micro benchmarks
benchmark
function benchmarksForAll() { var i = '12345', j; var start = Date.now();
for (var n = 0; n < 1e6; n++) { j = ~~i; } return (Date.now() - start); }
benchmark
function benchmarksForAll() {
var j;
var start = Date.now()
for (var n = 0; n < 1e6; n++) {
j = ~~'12345';
}
return (Date.now() - start);
}
benchmark
function benchmarksForAll() {
var j;
var start = Date.now()
for (var n = 0; n < 1e6; n++) {
j = 12345;
}
return (Date.now() - start);
}
And we measured ...
ember benchmarks & demo
Ember.js: And benchmarks for all
By twokul
Ember.js: And benchmarks for all
- 2,450