Understand Sury's architecture and performance characteristics
mainSury is a high-performance validation library designed for small bundle sizes and extreme execution speed.
Key Architectural Traits
- Modular API: Instead of large classes, Sury uses small, independent functions. This allows bundlers to perform effective tree-shaking, potentially reducing shipped size by up to 2× compared to Zod.
- Compiled Schemas: For maximum performance, Sury compiles schemas into specialized code using
new Function. This makes it one of the fastest composable validation libraries available. - Standard Schema Support: Sury implements the Standard Schema specification, making it compatible with over 32+ libraries that support this spec.
- JSON Schema Integration: You can convert schemas to and from JSON Schema using
S.toJSONSchemaandS.fromJSONSchema.
Performance Comparison (Summary)
Sury is optimized for both bundle size and runtime throughput, specifically excelling in 'Parse with the same schema' benchmarks due to its compilation approach.