Skip to content

Optimize SchemaBinary parser hot paths - #7369

Merged
tim-smart merged 3 commits into
agent/codex-engineer/58cacc24from
agent/codex-engineer/c452041f
Aug 20, 2026
Merged

Optimize SchemaBinary parser hot paths#7369
tim-smart merged 3 commits into
agent/codex-engineer/58cacc24from
agent/codex-engineer/c452041f

Conversation

@tim-smart

@tim-smart tim-smart commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

Summary

  • retain parser-owned index-signature classifications within a 256-entry hard bound without cycling the entire cache on wider frames
  • reuse Reader and DataView state across frames and one-shot decodes, then release input buffers on pool return and every terminal parser path
  • parse common frame headers with number arithmetic and seed the bigint fallback from the first six groups
  • cover the above-capacity cache and incremental bigint-header paths, and extend the benchmark with a 512-key case and first-byte fragmentation

Results

  • small parser cases: 12-19% faster in the same-harness comparison
  • nested parser cases: 5-8% faster
  • collections: 19-24% faster
  • 128-key index-signature case: 90-93% faster after warmup
  • 512-key index-signature case: 32-42% faster instead of regressing above the cache bound
  • no wire-format or public-API changes

Verification

  • nix develop -c pnpm --filter effect test --run test/unstable/encoding/SchemaBinary.test.ts
  • nix develop -c pnpm lint
  • nix develop -c pnpm check
  • nix develop -c pnpm --dir packages/effect exec node benchmark/schema/SchemaBinary.ts

Stacked on #7366 at 8e60b33c2. Keep this PR open for the EFF-780 fingerprint-mode work.

Closes EFF-782

@changeset-bot

changeset-bot Bot commented Aug 20, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 67ca31f

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@effect-slopcop effect-slopcop Bot added the bug Something isn't working label Aug 20, 2026
@tim-smart
tim-smart merged commit 0d9caf9 into agent/codex-engineer/58cacc24 Aug 20, 2026
@tim-smart
tim-smart deleted the agent/codex-engineer/c452041f branch August 20, 2026 09:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant