Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions benches/scripts/calls/call_arrow.js
Original file line number Diff line number Diff line change
@@ -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;
}
12 changes: 12 additions & 0 deletions benches/scripts/calls/call_construct.js
Original file line number Diff line number Diff line change
@@ -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;
}
14 changes: 14 additions & 0 deletions benches/scripts/calls/call_simple.js
Original file line number Diff line number Diff line change
@@ -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;
}