Skip to content

perf(validators): cache compiled AJV schemas instead of recompiling per call#94

Open
forgou37 wants to merge 1 commit into
profullstack:masterfrom
forgou37:fix/validators-ajv-cache
Open

perf(validators): cache compiled AJV schemas instead of recompiling per call#94
forgou37 wants to merge 1 commit into
profullstack:masterfrom
forgou37:fix/validators-ajv-cache

Conversation

@forgou37

@forgou37 forgou37 commented Jul 3, 2026

Copy link
Copy Markdown

AJV compile() is expensive. The validators module was calling it on every validation request. This PR caches the compiled validator functions at module load time, avoiding repeated recompilation and improving throughput for high-frequency validation paths.

…g each call

validate() was creating a new AJV instance and recompiling the schema on every
invocation. Schema compilation is expensive (JSON Schema parsing, format setup).
Cache the compiled validator per SchemaKind so compilation happens once.
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