Skip to content

Frontend: optimize lexing, parsing, bytecode, and module compilation #496

Description

@chrisbbreuer

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

Foundation

Current pipeline: src/lexer.zigsrc/parser.zig/ast.zigsrc/compiler.zig/bytecode.zig; module streaming work under #406#410.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestperformanceMeasured runtime, memory, scaling, or build performanceruntimeJavaScript runtime and builtin implementation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions