blob: c1d71cbd21b304765e3244e5d8fbf61220879120 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
describe('perf misc', function(){
it('operation speeds', function(){
perf(
function typeByTypeof(){ return typeof noop == 'function'; }, // WINNER
function typeByProperty() { return noop.apply && noop.call; },
function typeByConstructor() { return noop.constructor == Function; }
);
});
it('property access', function(){
var name = 'value';
var none = 'x';
var scope = {};
perf(
function direct(){ return scope.value; }, // WINNER
function byName() { return scope[name]; },
function undefinedDirect(){ return scope.x; },
function undefiendByName() { return scope[none]; }
);
});
});
|