Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
factory function vs function
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/135.0.0.0 Safari/537.36
Browser:
Chrome 135
Operating system:
Mac OS X 10.15.7
Device Platform:
Desktop
Date tested:
one year ago
factory call
177.9M/s
function init
163.8M/s
factory init
153.2M/s
function call
150.4M/s
View exact numbers
Test name
Executions per second
✓
factory call
177,862,784 Ops/sec
function init
163,807,744 Ops/sec
factory init
153,218,192 Ops/sec
function call
150,422,208 Ops/sec
Script Preparation code:
function factory(){ return ()=>{ const a = "A" return a; } }
Tests:
factory call
const foo = factory(); function bar (){ const a = "A" return a; } foo(); foo(); foo(); foo(); foo(); foo();
function call
const foo = factory(); function bar (){ const a = "A" return a; } bar(); bar(); bar(); bar(); bar(); bar();
factory init
const fooA = factory(); const fooB = factory(); const fooC = factory(); const fooD = factory(); const fooE = factory(); const fooF = factory();
function init
function barA (){ const a = "A" return a; } function barB (){ const a = "A" return a; } function barC (){ const a = "A" return a; } function barD (){ const a = "A" return a; } function barE (){ const a = "A" return a; } function barF (){ const a = "A" return a; }