Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Function constructor (2)
Constructing a Function() by passing args into the constructor or generated method
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/133.0.0.0 Safari/537.36
Browser:
Chrome 133
Operating system:
Windows
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
Pass arg via constructor
37803588.0 Ops/sec
Pass args to function.
38003728.0 Ops/sec
Script Preparation code:
ab = new ArrayBuffer(1000*4); u32 = new Uint32Array(ab); code1 = `return function foo() { for (let i = 0; i < localCount; i++) { localArr[localCount]++; } }`; fnConstructor = new Function("localArr", "localCount", code1)(u32, 100); code2 = `return function foo(argArr, argCount) { for (let i = 0; i < argCount; i++) { argArr[argCount]++; } }`; fnWithArgs = new Function(code2)();
Tests:
Pass arg via constructor
fnConstructor();
Pass args to function.
fnWithArgs(u32, 100);