Schema validation performance versus Ajv
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 5/5
- Tiempo estimado
- Más de una semana
- Aptitud para principiantes
- 35/100
- Tipo de issue
- Nueva funcionalidad
- Claridad
- Necesita aclaración
- Estado de actividad
- Activo
- Stack tecnológico
- typescript
- Área
- performance
Línea de trabajo
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.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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.
- Lenguaje dominante
- TypeScript
- Estrellas
- 16.7k
- Forks
- 808
- Merge medio
- 21 h 22 min
- PR fusionados (30 d)
- 486
Preparar el entorno
Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de Effect-TS/effect
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
`@effect/ui-native` (Effect-TS/ui): `kit/VirtualList` `list` part widens `R` to `any`, poisoning enclosing componentsPosiblemente ocupada @effect-bot la tomó hoy. Abierto
Effect-TS/effect#11097 · 1 asignado ·
Los mantenedores suelen responder en 1 día
-
`@effect/ui-native` (Effect-TS/ui): Controlled `input` rejected-edit restore never calls `host.commit()`Posiblemente ocupada @effect-bot la tomó hoy. Abierto
Effect-TS/effect#11096 · 1 asignado ·
Los mantenedores suelen responder en 1 día
Todos los issues de Effect-TS/effect
Issues similares
-
check:failed streams:edit
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
iptv-org/iptv#60585 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 67/100
Los mantenedores suelen responder en 1 día
-
[Bug]: Critical path skips a child span that ends exactly when the next one startsPosiblemente ocupada @Piyush4801 la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
jaegertracing/jaeger-ui#4865 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 90/100
anthropics/claude-code#112972 ·
-
Type: Improvement
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
Los mantenedores suelen responder en 1 día