Performance

Compare contracts first.

litetype requires own properties and plain objects. Default AJV and ArkType accept inherited fields, so their fastest rows validate a weaker object contract.

5.00 kB gzipSmallest runtime library in this comparison.

Runtime throughput

Node 22.18.0, Apple M4 Max, 1,024 rotating inputs. Median of seven samples after warmup. Higher is better.

CaselitetypeZod 4AJV defaultAJV ownArkType
Flat valid90.47M33.76M98.03M27.32M53.64M
Flat invalid0.44M0.21M61.29M22.87M0.59M
Nested ×10 valid8.49M2.62M22.81M5.31M23.60M
Nested ×10 invalid0.22M0.15M6.84M3.45M0.20M
Discriminated union27.42M23.51M116.81M41.97M68.40M
Cross-field refine23.64M10.90M42.89M27.99M43.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

RuntimeMinifiedGzipBrotli
litetype17.80 kB5.00 kB4.55 kB
Zod327.27 kB64.62 kB53.93 kB
AJV runtime118.33 kB36.35 kB32.34 kB
ArkType153.47 kB46.89 kB41.41 kB
AJV standalone1.97 kB0.50 kB0.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 construction3.82 µsZod 22.38 µs · AJV 111.28 µs · ArkType 44.33 µs
TypeScript instantiations341CI budget: 10,000
npm tarball30.1 kBZod 759.6 kB · AJV 217.6 kB · ArkType 70.0 kB*

Reproduce

Terminal
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.