diff --git a/benches/scripts/calls/call_arrow.js b/benches/scripts/calls/call_arrow.js new file mode 100644 index 00000000000..62f10c19230 --- /dev/null +++ b/benches/scripts/calls/call_arrow.js @@ -0,0 +1,11 @@ +// Keep the function body minimal so repeated calls dominate the benchmark. +const iterationCount = 10_000; +const identity = (value) => value; + +function main() { + let result = 0; + for (let i = 0; i < iterationCount; i++) { + result += identity(i); + } + return result; +} diff --git a/benches/scripts/calls/call_construct.js b/benches/scripts/calls/call_construct.js new file mode 100644 index 00000000000..87775017c1b --- /dev/null +++ b/benches/scripts/calls/call_construct.js @@ -0,0 +1,12 @@ +// Repeated construction isolates the constructor call path. +const iterationCount = 10_000; + +function Empty() {} + +function main() { + let instance; + for (let i = 0; i < iterationCount; i++) { + instance = new Empty(); + } + return instance; +} diff --git a/benches/scripts/calls/call_simple.js b/benches/scripts/calls/call_simple.js new file mode 100644 index 00000000000..ae2b57aada8 --- /dev/null +++ b/benches/scripts/calls/call_simple.js @@ -0,0 +1,14 @@ +// Keep the function body minimal so repeated calls dominate the benchmark. +const iterationCount = 10_000; + +function identity(value) { + return value; +} + +function main() { + let result = 0; + for (let i = 0; i < iterationCount; i++) { + result += identity(i); + } + return result; +}