Skip to content

Skip context variable setup in named type parsers when context variables are disabled - #355

Open
keichi wants to merge 1 commit into
masterfrom
skip-alias-context-vars
Open

keichi wants to merge 1 commit into
masterfrom
skip-alias-context-vars

Conversation

@keichi

@keichi keichi commented Nov 22, 2026

Copy link
Copy Markdown
Owner

Parser functions generated for named types (namely) always copied $parent/$root (and the passed context) onto the result object, then removed them with delete, even when useContextVars() was not called. Every result object therefore went into dictionary mode, which made arrays of named types very slow.

This PR emits that code only when context variables are enabled.

Benchmark (array of 1000 {x, y, z} elements of a named type, context variables disabled, Node.js):

ops/s
before 6.7k
after 208k

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