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
Test name
Executions per second
factory call
177862784.0 Ops/sec
function call
150422208.0 Ops/sec
factory init
153218192.0 Ops/sec
function init
163807744.0 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; }