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
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;
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;
function benchmarksForAll() { var i = '12345', j; var start = Date.now();
for (var n = 0; n < 1e6; n++) { j = ~~i; } return (Date.now() - start); }
function benchmarksForAll() {
var j;
var start = Date.now()
for (var n = 0; n < 1e6; n++) {
j = ~~'12345';
}
return (Date.now() - start);
}
function benchmarksForAll() {
var j;
var start = Date.now()
for (var n = 0; n < 1e6; n++) {
j = 12345;
}
return (Date.now() - start);
}