Skip to content

perf(inspectors): build JS opcode names on first use - #1161

Closed
mattsse wants to merge 1 commit into
mainfrom
perf/js-opcode-name-cache
Closed

mattsse wants to merge 1 commit into
mainfrom
perf/js-opcode-name-cache

Conversation

@mattsse

@mattsse mattsse commented Nov 29, 2026 •

Copy link
Copy Markdown
Member

A tracer reading log.op.toString() once used to initialize all 256 JavaScript strings for that inspector, including the formatted names of undefined opcodes. Fill a slot only when the tracer asks for that opcode, and reuse the immutable string across inspectors on the same thread. The log wrappers remain per transaction.

On a transaction executing a single STOP, the first lookup on a fresh inspector avoided 359 allocator requests and 26,140 requested bytes on an already-used worker. On the worker's very first transaction it avoided 357 requests and 24,020 bytes, including the new table and its first entry. The benefit is concentrated in tracing the first transaction of a fresh inspector. Long-running inspectors already reused their table.

The table occupies 2 KiB on the measured 64-bit host and is created only on threads that use opcode names. The change also removes the inspector's per-instance cache handle.

Measured release execution through JSON result collection against 0b079aa, with fresh-inspector construction outside the first-lookup measurement. The new test covers defined names and geth's spelling for undefined opcodes. Inspector all-feature release tests and Clippy passed.

A follow-up on two pinned cores found a warm-workload tradeoff. On the router, geth's unmodified unigram script took 22.84 ms on main and 24.02 ms on this branch, while the simpler per-step opcode-name reader took 11.99 ms and 11.84 ms respectively. This draft targets fresh inspectors. The full-script regression merits consideration before merge.

This branch was previously deployed

1 inactive deployment
codspeed — 210df26b Deployed Nov 29, 2026 by mattsse via codspeed (jit) #3507
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.

1 participant