Parent: #459 Depends on: #460, #461, #465, #479, #481
Goal
Optimize lexing, parsing, AST/bytecode generation, source evaluation, and module compilation for cold and dynamic code without hiding compilation outside timed boundaries.
Scope
- Add source-size/syntax-mix benchmarks for scripts, modules, functions/constructors, direct eval, dynamic import, JSON-like literals, classes/private fields, async/generators, Unicode identifiers/strings/templates, regex literals, and invalid syntax diagnostics.
- Attribute lex/token storage, AST allocation/layout, scope analysis, bytecode emission, constant/name tables, source maps/locations, debugger registration, optimizer metadata, and allocator/GC pressure.
- Reduce passes/allocations and improve locality; consider direct bytecode emission or compact transient IR only with exact diagnostics, early errors, source ranges, and tree-walker availability.
- Reuse immutable parse/compile artifacts only with exact source/options/realm/dynamic-scope keys and bounded lifecycle.
- Optimize streaming/module compilation incrementally while preserving failure atomicity and exact final bytes.
No-workaround rules
- No precompiled benchmark source, omitted source locations/debug metadata, delayed syntax error, reduced Unicode/Annex B/module behavior, hash-only cache collision risk, or third-party parser/compiler.
Acceptance
- #460 publishes parse/compile/evaluate cold and warm latency, CPU, allocations, peak RSS, bytecode/code bytes, and diagnostics for valid/invalid sources.
- Parser/compiler/tree-walker/VM forced differentials and full test262/module/Annex B/source-location/debugger gates pass.
- Streaming and OOM/fault paths are failure-atomic and bounded.
- Exact-parent evidence proves phase/allocation improvements without hiding work in cache warmup.
- Cold lifecycle #479 and tiering #481 consume the results without regressing #44.
Foundation
Current pipeline: src/lexer.zig → src/parser.zig/ast.zig → src/compiler.zig/bytecode.zig; module streaming work under #406–#410.