Performance
litetype vs Zod, AJV, and ArkType
litetype requires own properties and plain objects. Default AJV and ArkType accept inherited fields, so their fastest rows validate a weaker object contract.
Runtime throughput
Node 22.18.0, Apple M4 Max, 1,024 rotating inputs. Median of seven samples after warmup. Higher is better.
| Case | litetype | Zod 4 | AJV default | AJV own | ArkType |
|---|---|---|---|---|---|
| Flat valid | 90.47M | 33.76M | 98.03M | 27.32M | 53.64M |
| Flat invalid | 0.44M | 0.21M | 61.29M | 22.87M | 0.59M |
| Nested ×10 valid | 8.49M | 2.62M | 22.81M | 5.31M | 23.60M |
| Nested ×10 invalid | 0.22M | 0.15M | 6.84M | 3.45M | 0.20M |
| Discriminated union | 27.42M | 23.51M | 116.81M | 41.97M | 68.40M |
| Cross-field refine | 23.64M | 10.90M | 42.89M | 27.99M | 43.59M |
AJV own enables ownProperties: true, matching litetype's required-key policy more closely. AJV returns a boolean on failure; litetype, Zod and ArkType construct structured errors.
Size
| Runtime | Minified | Gzip | Brotli |
|---|---|---|---|
| litetype | 17.80 kB | 5.00 kB | 4.55 kB |
| Zod | 327.27 kB | 64.62 kB | 53.93 kB |
| AJV runtime | 118.33 kB | 36.35 kB | 32.34 kB |
| ArkType | 153.47 kB | 46.89 kB | 41.41 kB |
| AJV standalone | 1.97 kB | 0.50 kB | 0.42 kB |
AJV standalone moves generation to build time and ships no runtime compiler. If schemas are static and a generation step is acceptable, it is smaller and faster than every runtime-schema library here.
Construction and TypeScript
| Ready validator construction | 3.82 µs | Zod 22.38 µs · AJV 111.28 µs · ArkType 44.33 µs |
| TypeScript instantiations | 341 | CI budget: 10,000 |
| npm tarball | 30.1 kB | Zod 759.6 kB · AJV 217.6 kB · ArkType 70.0 kB* |
Reproduce
git clone https://github.com/nightsumx/litetype.git
cd litetype
bun install
bun run bench
bun run bench:size
bun run perf:type
Absolute values depend on the machine. The fixtures, warmup, samples and object-policy notes live in BENCH.md.