Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Function call vs bind vs bind and call vs function.call
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36
Browser:
Chrome 146
Operating system:
Windows
Device Platform:
Desktop
Date tested:
one month ago
Test name
Executions per second
Function
273630.4 Ops/sec
Function bind
20312.4 Ops/sec
Function bind and call
31574.7 Ops/sec
Function call
167447.6 Ops/sec
Script Preparation code:
function makeNode() { return { valid: Math.random() > 0.5 }; } function isNodeValid( node ) { return node.valid; } function isValid() { return this.valid; } const nodes = []; for( let i = 0; i < 10000; i++ ) { const node = makeNode(); node.isValid = isValid.bind( node ); nodes.push( node ); } function getNodes() { return nodes; }
Tests:
Function
getNodes().forEach( node => isNodeValid( node ) );
Function bind
getNodes().forEach( node => node.isValid() );
Function bind and call
getNodes().forEach( node => isValid.bind( node )() );
Function call
getNodes().forEach( node => isValid.call( node ) );