Skip to content

Optimize JS tracer callback object reuse#449

Open
haardikk21 wants to merge 3 commits into
paradigmxyz:mainfrom
haardikk21:hd/js-tracer-stable-objects
Open

Optimize JS tracer callback object reuse#449
haardikk21 wants to merge 3 commits into
paradigmxyz:mainfrom
haardikk21:hd/js-tracer-stable-objects

Conversation

@haardikk21
Copy link
Copy Markdown

@haardikk21 haardikk21 commented May 28, 2026

TL;DR

  • The old js-tracer hot path rebuilt fresh Boa wrapper objects on every step, fault, enter, and exit callback.
  • That per-callback object construction was the main source of overhead, especially for opcode-heavy tracers.
  • The fix here is to create stable reusable JS objects once and update shared Rust-side backing state before each callback.
  • The external JS tracer API does not change; scripts still use the same Geth-style methods and object shapes.
  • This PR also adds benchmark coverage for synthetic accessor-heavy workloads, Rundler-shaped workloads, real Rundler tracer scripts, and a real mainnet AA transaction replay.
  • The optimization materially improves all measured cases:
  • step_noop: 157.18 ms -> 4.1913 ms (37.5x)
  • step_accessors: 230.39 ms -> 38.457 ms (6.0x)
  • rundler_v06_real: 41.989 ms -> 15.463 ms (2.72x)
  • mainnet_aa_v06_real: 9.7643 ms -> 3.6274 ms (2.69x)
  • The mainnet AA improvement is smaller than the synthetic upper-bound cases because that benchmark includes more non-tracer work, not because the benchmark is broken.

Full writeup: https://hackmd.io/@vFMCdNzHQNqyPq_Rej0IIw/B16xdMPeGe

Comment thread src/tracing/js/mod.rs
@haardikk21 haardikk21 requested a review from DaniPopes June 1, 2026 13:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants