aboutsummaryrefslogtreecommitdiffstats
path: root/perf/MiscPerf.js
diff options
context:
space:
mode:
Diffstat (limited to 'perf/MiscPerf.js')
-rw-r--r--perf/MiscPerf.js21
1 files changed, 21 insertions, 0 deletions
diff --git a/perf/MiscPerf.js b/perf/MiscPerf.js
new file mode 100644
index 00000000..c1d71cbd
--- /dev/null
+++ b/perf/MiscPerf.js
@@ -0,0 +1,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]; }
+ );
+ });
+});