Skip to content

Runtime: optimize owned string, RegExp, and JSON pipelines #473

Description

@chrisbbreuer

Parent: #459
Depends on: #460, #465, #469

Goal

Build owned high-throughput string, RegExp, and JSON pipelines that are competitive with JSC across ASCII, UTF-8, UTF-16, Unicode-heavy, and adversarial inputs.

Scope

  • Profile and optimize string representation transitions, flat/slice/rope/concat forms, interning/atomization, hashing, equality, search, replace, split, case conversion, normalization, iteration, and property-key conversion.
  • Avoid repeated UTF-8/UTF-16 transcoding while preserving code-unit/code-point semantics, lone surrogates, normalization, locale behavior, and stable embedding views.
  • Extend the owned zig-regex integration with reusable compiled plans, literal admission, capture storage reuse, one-pass/DFA/backtrack selection, replacement expansion, Unicode sets/properties, and bounded failure behavior.
  • Add a streaming or iterative owned JSON parser/stringifier fast path with exact reviver/replacer/toJSON/property-order/cycle/BigInt/error semantics and bounded nesting.
  • Expose tier/runtime/allocator counters and memory profiles for these pipelines.

No-workaround rules

  • No system regex/JSON library, ICU, JSC/V8 code, third-party parser, invalid Unicode shortcut, omitted capture/replacer behavior, or input-specific precomputation.
  • Cache keys and lifetimes must be bounded, content-correct, realm-safe, and no-GIL synchronized.

Acceptance

  • Bench: define the representative dependency-free performance matrix #460 includes small/large, ASCII/Unicode, flat/rope, match/no-match/pathological, parse/stringify, and callback-observable rows.
  • test262, Unicode/CLDR generators, regex dependency tests, fuzzing, OOM, deep input, GC, no-GIL, and TSan pass.
  • Exact-parent profiles prove lower conversion/allocation/backtracking/hash/dispatch cost with bounded memory.
  • Every accepted direct JSC comparison row wins on the declared host with exact output/checksum equality.
  • build.zig.zon retains only the owned local zig-regex dependency for regex semantics.

Foundation

Current canonical semantics live in src/value.zig, src/jsstring.zig, src/interpreter.zig, and the sibling ../zig-regex package.

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