Return true vs empty body
Date tested:
8 years ago
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.116 Safari/537.36
Test name
Executions per second
emptyFunc
9833313.0 Ops/sec
trueFunc
10002140.0 Ops/sec
undefinedFunc
3388180.0 Ops/sec
Benchmark definition (click to collapse):
Script Preparation code:
var emptyFunc = function() {}; var trueFunc = function() { return true; } var undefinedFunc = function() { return undefined; }
Tests:
emptyFunc
emptyFunc();
trueFunc
trueFunc();
undefinedFunc
undefinedFunc();
Open this result on MeasureThat.net