Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
Feature Requests
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
Benchmark engine:
Benchmark.js
Pass args to function.
38.0M/s
Pass arg via constructor
37.8M/s
View exact numbers
Test name
Executions per second
✓
Pass args to function.
38,003,728 Ops/sec
Pass arg via constructor
37,803,588 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);