Schema validation performance versus Ajv
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 35/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Da chiarire
- Stato di attività
- Attiva
- Stack tecnologico
- typescript
- Ambito
- performance
Direzione di ricerca
Start by locating the Effect Schema interpreter, issue collection and generated fast paths, then compare their behavior with the reproducible benchmarks for structs containing a Json index-signature child or a Uint8Array field. Measure valid and error paths and check the existing required, enum, pattern, length and onExcessProperty options. Done means a measured improvement with generated results matching interpreter behavior and validation semantics preserved.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Background
I use Effect Schema to validate data at storage and API boundaries. Ajv is the standard, well-maintained JSON Schema validator and the natural point of comparison. I benchmarked the two because a performance gap in this layer would affect a lot of applications, even if most of them would never notice it in day-to-day use. Effect targets size and speed, so I think a gap of this size is worth understanding and reducing where that can be done without changing what validation means.
What I measured
I started with a representative set of record-like schemas, which I have not included here. Against Ajv, Effect was roughly 4.7x slower on the valid path and roughly 57x slower on the error path. The synthetic shapes I use for the reproducible benchmark are simpler, so they show smaller gaps: about 2.7x on a boolean error path and about 2.8x and 1.8x from generated fast paths. Those two shapes are a struct with a Json index-signature child and a struct with a Uint8Array field. The synthetic results do not reproduce the larger ratios from the representative set, and nothing in this report depends on that set being available.
The mechanism is consistent across both measurements. Valid documents spend their time in the interpreter and in issue collection, even when no issue is produced. Errors spend time in error-mode handling and in the per-key excess-property check. Thrown SchemaError objects are not the main cost: throwing, returning and bare-issue paths all landed within 13% of each other.
Possible directions
These are candidates I want to discuss, not commitments I am making here:
- An options-aware boolean validation path. Callers that only need accept or reject could enforce a strict contract such as
onExcessProperty: "error"without building issue details on the valid path. - Generated fast paths for common declaration shapes. The Json index signature and Uint8Array shapes currently push a whole struct onto the interpreter; compiling them directly is a contained way to bring more schemas onto the fast path.
- Caching excess-key metadata. Declared property names are fixed per schema, so rebuilding them for every document looks avoidable.
Scope and limits
I do not want to change validation semantics. Any direction has to keep the existing checks and options, including required, enum, pattern, length and onExcessProperty, and generated results need to match the interpreter. The numbers come from one host and are relative signals rather than a service level guarantee.
- Lingua principale
- TypeScript
- Stelle
- 16.7k
- Fork
- 808
- Merge medio
- 21h 22m
- PR unite (30g)
- 486
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di Effect-TS/effect
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
`@effect/ui-native` (Effect-TS/ui): `kit/VirtualList` `list` part widens `R` to `any`, poisoning enclosing componentsForse già presa @effect-bot l’ha presa oggi. Aperta
Effect-TS/effect#11097 · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
-
`@effect/ui-native` (Effect-TS/ui): Controlled `input` rejected-edit restore never calls `host.commit()`Forse già presa @effect-bot l’ha presa oggi. Aperta
Effect-TS/effect#11096 · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di Effect-TS/effect
Issue simili
-
check:failed streams:edit
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
iptv-org/iptv#60585 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 67/100
I maintainer di solito rispondono entro 1 giorno
-
[Bug]: Critical path skips a child span that ends exactly when the next one startsForse già presa @Piyush4801 l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
jaegertracing/jaeger-ui#4865 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 90/100
anthropics/claude-code#112972 ·
-
Type: Improvement
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
I maintainer di solito rispondono entro 1 giorno