Skip to content

[BENCH] Add call opcode microbenchmarks - #5701

Open
Harshbhargav45 wants to merge 1 commit into
boa-dev:mainfrom
Harshbhargav45:docs/5204-call-opcode-benchmarks
Open

Harshbhargav45 wants to merge 1 commit into
boa-dev:mainfrom
Harshbhargav45:docs/5204-call-opcode-benchmarks

Conversation

@Harshbhargav45

Copy link
Copy Markdown

This Pull Request fixes #5204.

It changes the following:

  • Adds Criterion-discovered scripts for ordinary function calls, arrow-function calls, and constructor calls.
  • Each script runs 10,000 calls per benchmark iteration and keeps the function body minimal.
  • Leaves the engine and benchmark harness unchanged.

Testing

  • cargo bench -p boa_benches --bench scripts -- '^calls/' --sample-size 10 --measurement-time 1 --warm-up-time 1 — passed; ran only the three new cases.
  • Executed each script's main() with Boa: the call scripts returned 49995000, and the construction script returned an Empty instance.
  • git diff --check — passed.

PR #5205 was closed as stale. This PR keeps the change limited to the benchmark scripts requested by the issue.

@Harshbhargav45
Harshbhargav45 requested a review from a team as a code owner November 28, 2026 17:24
@github-actions github-actions Bot added Waiting On Review Waiting on reviews from the maintainers C-Benchmark Issues and PRs related to the benchmark subsystem. C-Javascript Pull requests that update Javascript code labels Nov 28, 2026
@github-actions github-actions Bot added this to the v0.23 milestone Nov 28, 2026

@abdulhamid999 abdulhamid999 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed against benches/benches/scripts.rs, benches/scripts/basic/call-loop.js, and benches/scripts/closures/invoke.js (static inspection; not executed locally).

Findings

  • Benchmark harness integration: Confirmed benches/benches/scripts.rs discovers every .js file under benches/scripts/ via WalkDir and looks up global main(), so all three new scripts (call_arrow.js, call_construct.js, call_simple.js) integrate automatically and follow the existing main() return convention seen in closures/invoke.js.
  • Overlap & iteration count note: Note that benches/scripts/basic/call-loop.js already benchmarks 100_000 calls to a 0-argument function f(), whereas calls/call_simple.js uses 10_000 iterations of a 1-argument identity(i) call accumulated via += (result += identity(i)). Using 10_000 (iterationCount) vs 100_000 in existing scripts is fine if intentional for criterion sample timings, though worth keeping in mind if comparing call_simple directly against basic/call-loop.
  • Nice coverage expansion for arrow calls and constructor calls (new Empty()).

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

C-Benchmark Issues and PRs related to the benchmark subsystem. C-Javascript Pull requests that update Javascript code Waiting On Review Waiting on reviews from the maintainers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Performance: Profile and micro-benchmark Call opcode variants

2 participants