blob: 98d51a9f8886075bae0b0671704174209817b79f (
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]; }
);
});
});
|