Kanon Performance Benchmarks
Real-world validation benchmarks. Data auto-generated on Mar 14, 2026.
TL;DR
Kanon JIT dominates on discriminated unions and complex schemas. TypeBox/AJV win on simple validations. For typical API/form validation, Kanon is 2-3x faster than Zod/Valibot.
Operations per second. Higher is better.
Methodology
Each benchmark:
- Creates a pool of 10,000 test objects
- Runs validation in a tight loop
- Measures operations per second with statistical analysis
- Reports min, max, mean, percentiles (p75, p99, p995, p999)
- Includes relative margin of error (rme) for confidence
The "fastest" label is only awarded when the winner is ≥10% faster than the runner-up. Otherwise, it's considered a statistical tie.
Does Performance Matter?
Not all validations matter equally for performance. Validating an API response called 1000x/sec matters more than a one-time config check. We assign weights based on real-world usage patterns:
| Perf matters? | Weight | Description | Examples |
|---|---|---|---|
CRITICAL A lot | 5 pts | Hot path functions called in tight loops | map, filter, reduce, groupBy, chunk |
HIGH Yes | 3 pts | Frequently used utilities, but not in tight loops | get, set, pick, omit, cloneDeep |
MEDIUM A bit | 1 pt | Occasional utilities | Type guards (isArray, isString), string formatting |
LOW No | 0.5 pts | Setup-only functions where runtime perf is irrelevant | debounce, throttle, once, memoize |
This scoring gives a more realistic picture of which library will actually make your app faster.
Libraries Tested
| Library | Version | Description |
|---|---|---|
| @sinclair/typebox | 0.34.48 | JSON Schema with TypeScript inference + JIT |
| ajv | 8.18.0 | JSON Schema validator with JIT compilation |
| effect | 3.19.19 | Full-featured TypeScript library with schema validation |
| fastest-validator | 1.19.1 | High-performance validator with JIT |
| kanon | 2.3.0 | Pithos validation module (schema-first + JIT) |
| superstruct | 2.0.2 | Composable validation with custom types |
| valibot | 1.2.0 | Modular schema validation, tree-shakable |
| zod | 4.3.6 | Schema-first validation with TypeScript inference |
Benchmark Results
| Test | @kanon/V3.0 | @kanon/JIT | AJV | Effect | Fast-Validator | Superstruct | TypeBox | Valibot | Zod |
|---|---|---|---|---|---|---|---|---|---|
| Critical | |||||||||
Login Form Validation CRITICAL | 5 pts | 7.30M ops/s (2.22x) | 10.75M ops/s (1.51x) | 8.85M ops/s (1.83x) | 2.69M ops/s (6.03x) | 10.30M ops/s (1.57x) | 606.72K ops/s (26.74x) | 16.22M ops/s fastest | 3.35M ops/s (4.85x) | 4.84M ops/s (3.35x) |
Payment Form (conditional validation) CRITICAL | 5 pts | 5.54M ops/s (3.54x) | 19.57M ops/s fastest | 16.07M ops/s (1.22x) | 861.76K ops/s (22.71x) | 12.53M ops/s (1.56x) | 298.76K ops/s (65.51x) | 1.74M ops/s (11.24x) | 1.68M ops/s (11.63x) | 2.62M ops/s (7.48x) |
User Registration (with password confirm) CRITICAL | 5 pts | 5.04M ops/s (1.83x) | 6.37M ops/s (1.45x) | 6.95M ops/s (1.33x) | 1.04M ops/s (8.82x) | 6.91M ops/s (1.33x) | 302.28K ops/s (30.47x) | 9.21M ops/s fastest | 1.68M ops/s (5.48x) | 1.96M ops/s (4.71x) |
| High | |||||||||
API Response (discriminated union) HIGH | 3 pts | 8.54M ops/s (3.06x) | 26.14M ops/s fastest | 18.93M ops/s (1.38x) | 2.88M ops/s (9.07x) | 15.24M ops/s (1.72x) | 374.49K ops/s (69.8x) | 3.38M ops/s (7.74x) | 2.40M ops/s (10.88x) | 8.23M ops/s (3.17x) |
Blog Post with Comments HIGH | 3 pts | 2.53M ops/s (2.64x) | 6.70M ops/s fastest | 5.09M ops/s (1.32x) | 570.87K ops/s (11.73x) | 3.64M ops/s (1.84x) | 110.87K ops/s (60.39x) | 1.49M ops/s (4.48x) | 794.08K ops/s (8.43x) | 1.48M ops/s (4.52x) |
E-commerce Product HIGH | 3 pts | 4.93M ops/s (2.92x) | 14.40M ops/s fastest | 12.74M ops/s (1.13x) | 803.89K ops/s (17.92x) | 12.47M ops/s (1.15x) | 198.25K ops/s (72.65x) | 1.13M ops/s (12.72x) | 1.39M ops/s (10.32x) | 2.58M ops/s (5.57x) |
Event Booking HIGH | 3 pts | 1.65M ops/s (5.57x) | 9.16M ops/s fastest | 4.03M ops/s (2.27x) | 379.42K ops/s (24.15x) | 2.91M ops/s (3.15x) | 120.28K ops/s (76.18x) | 2.79M ops/s (3.29x) | 686.53K ops/s (13.35x) | 839.21K ops/s (10.92x) |
Invalid Login (error handling) HIGH | 3 pts | 5.76M ops/s (1.63x) | 9.26M ops/s (1.01x) | 9.38M ops/s fastest | 265.91K ops/s (35.28x) | 1.98M ops/s (4.74x) | 189.99K ops/s (49.37x) | 7.98M ops/s (1.18x) | 2.16M ops/s (4.34x) | 149.75K ops/s (62.64x) |
| Medium | |||||||||
Search Params (with coercion) MEDIUM | 1 pts | 5.05M ops/s (4.64x) | 23.37M ops/s (1x) | 23.43M ops/s fastest | 1.36M ops/s (17.27x) | 18.07M ops/s (1.3x) | 190.53K ops/s (122.97x) | 2.01M ops/s (11.68x) | 1.77M ops/s (13.24x) | 4.19M ops/s (5.59x) |
User Profile Update (optional fields) MEDIUM | 1 pts | 6.02M ops/s (3.08x) | 18.58M ops/s fastest | 7.88M ops/s (2.36x) | 2.72M ops/s (6.84x) | 11.62M ops/s (1.6x) | 453.75K ops/s (40.95x) | 5.32M ops/s (3.49x) | 2.34M ops/s (7.95x) | 2.08M ops/s (8.94x) |
📊 Performance Summary
@kanon/JIT
TypeBox
AJV📈 Weighted Summary
🏆 @kanon/JIT dominates real-world scenarios!
@kanon/JIT
TypeBox
AJVOn critical + high priority tasks, @kanon/JIT is 2.4x ahead.
Detailed Statistics
For the skeptics who want to see the raw numbers:
Login Form ValidationCRITICAL
| Library | ops/s | min | max | mean | p75 | p99 | p995 | p999 | rme | samples |
|---|---|---|---|---|---|---|---|---|---|---|
| TypeBox 🏆 | 16.22M | 0.0000 | 0.0160 | 0.0001 | 0.0001 | 0.0001 | 0.0001 | 0.0002 | ±0.03% | 8,110,826 |
| @kanon/JIT | 10.75M | 0.0000 | 0.0251 | 0.0001 | 0.0001 | 0.0001 | 0.0001 | 0.0002 | ±0.02% | 5,375,293 |
| Fast-Validator | 10.30M | 0.0000 | 0.0193 | 0.0001 | 0.0001 | 0.0001 | 0.0001 | 0.0002 | ±0.03% | 5,151,905 |
| AJV | 8.85M | 0.0000 | 0.3477 | 0.0001 | 0.0001 | 0.0001 | 0.0002 | 0.0002 | ±0.14% | 4,426,595 |
| @kanon/V3.0 | 7.30M | 0.0000 | 0.0334 | 0.0001 | 0.0002 | 0.0002 | 0.0002 | 0.0003 | ±0.04% | 3,649,270 |
| Zod | 4.84M | 0.0001 | 0.3160 | 0.0002 | 0.0002 | 0.0003 | 0.0003 | 0.0005 | ±0.28% | 2,418,545 |
| Valibot | 3.35M | 0.0002 | 0.3557 | 0.0003 | 0.0003 | 0.0004 | 0.0004 | 0.0005 | ±0.33% | 1,673,937 |
| Effect | 2.69M | 0.0002 | 0.3195 | 0.0004 | 0.0004 | 0.0005 | 0.0005 | 0.0007 | ±0.44% | 1,345,564 |
| Superstruct | 606.72K | 0.0014 | 0.3060 | 0.0016 | 0.0016 | 0.0021 | 0.0022 | 0.0028 | ±0.61% | 303,362 |
User Registration (with password confirm)CRITICAL
| Library | ops/s | min | max | mean | p75 | p99 | p995 | p999 | rme | samples |
|---|---|---|---|---|---|---|---|---|---|---|
| TypeBox 🏆 | 9.21M | 0.0000 | 0.3371 | 0.0001 | 0.0001 | 0.0001 | 0.0002 | 0.0003 | ±0.48% | 4,605,625 |
| AJV | 6.95M | 0.0000 | 0.2434 | 0.0001 | 0.0002 | 0.0002 | 0.0002 | 0.0003 | ±0.10% | 3,473,459 |
| Fast-Validator | 6.91M | 0.0000 | 0.7337 | 0.0001 | 0.0002 | 0.0002 | 0.0002 | 0.0003 | ±0.53% | 3,456,964 |
| @kanon/JIT | 6.37M | 0.0000 | 0.0193 | 0.0002 | 0.0002 | 0.0002 | 0.0002 | 0.0003 | ±0.03% | 3,183,797 |
| @kanon/V3.0 | 5.04M | 0.0001 | 0.0120 | 0.0002 | 0.0002 | 0.0003 | 0.0003 | 0.0003 | ±0.02% | 2,519,971 |
| Zod | 1.96M | 0.0004 | 0.5719 | 0.0005 | 0.0005 | 0.0007 | 0.0007 | 0.0010 | ±0.71% | 978,593 |
| Valibot | 1.68M | 0.0005 | 0.4611 | 0.0006 | 0.0006 | 0.0007 | 0.0007 | 0.0008 | ±0.45% | 840,156 |
| Effect | 1.04M | 0.0008 | 0.3644 | 0.0010 | 0.0010 | 0.0012 | 0.0012 | 0.0014 | ±0.40% | 522,297 |
| Superstruct | 302.28K | 0.0029 | 0.4256 | 0.0033 | 0.0033 | 0.0039 | 0.0041 | 0.0056 | ±0.60% | 151,139 |
API Response (discriminated union)HIGH
| Library | ops/s | min | max | mean | p75 | p99 | p995 | p999 | rme | samples |
|---|---|---|---|---|---|---|---|---|---|---|
| @kanon/JIT 🏆 | 26.14M | 0.0000 | 0.0310 | 0.0000 | 0.0000 | 0.0000 | 0.0001 | 0.0001 | ±0.03% | 13,069,900 |
| AJV | 18.93M | 0.0000 | 0.4032 | 0.0001 | 0.0000 | 0.0001 | 0.0001 | 0.0002 | ±0.43% | 9,466,101 |
| Fast-Validator | 15.24M | 0.0000 | 0.9756 | 0.0001 | 0.0001 | 0.0001 | 0.0001 | 0.0002 | ±0.38% | 7,620,768 |
| @kanon/V3.0 | 8.54M | 0.0000 | 0.0126 | 0.0001 | 0.0001 | 0.0001 | 0.0002 | 0.0002 | ±0.02% | 4,271,265 |
| Zod | 8.23M | 0.0000 | 0.3493 | 0.0001 | 0.0001 | 0.0002 | 0.0002 | 0.0003 | ±0.38% | 4,117,143 |
| TypeBox | 3.38M | 0.0002 | 0.3417 | 0.0003 | 0.0003 | 0.0004 | 0.0004 | 0.0005 | ±0.34% | 1,688,336 |
| Effect | 2.88M | 0.0002 | 0.3228 | 0.0003 | 0.0003 | 0.0005 | 0.0005 | 0.0007 | ±0.49% | 1,440,551 |
| Valibot | 2.40M | 0.0003 | 0.3029 | 0.0004 | 0.0005 | 0.0005 | 0.0006 | 0.0006 | ±0.16% | 1,201,783 |
| Superstruct | 374.49K | 0.0020 | 0.3914 | 0.0027 | 0.0034 | 0.0039 | 0.0040 | 0.0050 | ±0.55% | 187,246 |
E-commerce ProductHIGH
| Library | ops/s | min | max | mean | p75 | p99 | p995 | p999 | rme | samples |
|---|---|---|---|---|---|---|---|---|---|---|
| @kanon/JIT 🏆 | 14.40M | 0.0000 | 0.0372 | 0.0001 | 0.0001 | 0.0001 | 0.0001 | 0.0002 | ±0.03% | 7,201,078 |
| AJV | 12.74M | 0.0000 | 0.0109 | 0.0001 | 0.0001 | 0.0001 | 0.0001 | 0.0002 | ±0.02% | 6,371,751 |
| Fast-Validator | 12.47M | 0.0000 | 0.4601 | 0.0001 | 0.0001 | 0.0001 | 0.0001 | 0.0002 | ±0.40% | 6,237,172 |
| @kanon/V3.0 | 4.93M | 0.0001 | 0.0544 | 0.0002 | 0.0002 | 0.0003 | 0.0003 | 0.0004 | ±0.04% | 2,462,980 |
| Zod | 2.58M | 0.0003 | 0.4524 | 0.0004 | 0.0004 | 0.0005 | 0.0006 | 0.0007 | ±0.50% | 1,292,474 |
| Valibot | 1.39M | 0.0005 | 0.3606 | 0.0007 | 0.0008 | 0.0009 | 0.0010 | 0.0011 | ±0.40% | 697,498 |
| TypeBox | 1.13M | 0.0007 | 0.4893 | 0.0009 | 0.0010 | 0.0011 | 0.0011 | 0.0013 | ±0.19% | 566,269 |
| Effect | 803.89K | 0.0010 | 0.2753 | 0.0012 | 0.0013 | 0.0015 | 0.0016 | 0.0018 | ±0.50% | 401,946 |
| Superstruct | 198.25K | 0.0043 | 0.3490 | 0.0050 | 0.0053 | 0.0060 | 0.0063 | 0.0091 | ±0.51% | 99,123 |
Blog Post with CommentsHIGH
| Library | ops/s | min | max | mean | p75 | p99 | p995 | p999 | rme | samples |
|---|---|---|---|---|---|---|---|---|---|---|
| @kanon/JIT 🏆 | 6.70M | 0.0000 | 0.0270 | 0.0001 | 0.0002 | 0.0002 | 0.0002 | 0.0003 | ±0.05% | 3,347,674 |
| AJV | 5.09M | 0.0001 | 0.4245 | 0.0002 | 0.0002 | 0.0003 | 0.0003 | 0.0003 | ±0.17% | 2,545,400 |
| Fast-Validator | 3.64M | 0.0001 | 0.5038 | 0.0003 | 0.0003 | 0.0004 | 0.0005 | 0.0006 | ±0.20% | 1,822,243 |
| @kanon/V3.0 | 2.53M | 0.0002 | 0.0180 | 0.0004 | 0.0005 | 0.0005 | 0.0006 | 0.0007 | ±0.04% | 1,267,014 |
| TypeBox | 1.49M | 0.0005 | 0.4178 | 0.0007 | 0.0007 | 0.0008 | 0.0008 | 0.0010 | ±0.32% | 746,601 |
| Zod | 1.48M | 0.0005 | 0.4118 | 0.0007 | 0.0007 | 0.0010 | 0.0010 | 0.0012 | ±0.47% | 740,333 |
| Valibot | 794.08K | 0.0007 | 0.3297 | 0.0013 | 0.0015 | 0.0018 | 0.0019 | 0.0022 | ±0.36% | 397,041 |
| Effect | 570.87K | 0.0012 | 0.3074 | 0.0018 | 0.0020 | 0.0024 | 0.0025 | 0.0029 | ±0.45% | 285,436 |
| Superstruct | 110.87K | 0.0053 | 0.2614 | 0.0090 | 0.0105 | 0.0136 | 0.0160 | 0.0328 | ±0.50% | 55,436 |
Search Params (with coercion)MEDIUM
| Library | ops/s | min | max | mean | p75 | p99 | p995 | p999 | rme | samples |
|---|---|---|---|---|---|---|---|---|---|---|
| AJV 🏆 | 23.43M | 0.0000 | 0.5813 | 0.0000 | 0.0000 | 0.0001 | 0.0001 | 0.0001 | ±0.30% | 11,715,355 |
| @kanon/JIT | 23.37M | 0.0000 | 0.0342 | 0.0000 | 0.0000 | 0.0001 | 0.0001 | 0.0001 | ±0.03% | 11,685,828 |
| Fast-Validator | 18.07M | 0.0000 | 0.0195 | 0.0001 | 0.0001 | 0.0001 | 0.0001 | 0.0001 | ±0.03% | 9,033,883 |
| @kanon/V3.0 | 5.05M | 0.0001 | 0.3721 | 0.0002 | 0.0002 | 0.0002 | 0.0003 | 0.0004 | ±0.45% | 2,525,489 |
| Zod | 4.19M | 0.0001 | 0.5748 | 0.0002 | 0.0002 | 0.0003 | 0.0004 | 0.0005 | ±0.54% | 2,097,472 |
| TypeBox | 2.01M | 0.0004 | 0.4598 | 0.0005 | 0.0005 | 0.0006 | 0.0006 | 0.0007 | ±0.28% | 1,002,752 |
| Valibot | 1.77M | 0.0005 | 0.2843 | 0.0006 | 0.0006 | 0.0007 | 0.0007 | 0.0009 | ±0.23% | 884,974 |
| Effect | 1.36M | 0.0006 | 0.3948 | 0.0007 | 0.0008 | 0.0009 | 0.0010 | 0.0011 | ±0.41% | 678,193 |
| Superstruct | 190.53K | 0.0048 | 2.7560 | 0.0052 | 0.0052 | 0.0079 | 0.0082 | 0.0096 | ±1.31% | 95,268 |
User Profile Update (optional fields)MEDIUM
| Library | ops/s | min | max | mean | p75 | p99 | p995 | p999 | rme | samples |
|---|---|---|---|---|---|---|---|---|---|---|
| @kanon/JIT 🏆 | 18.58M | 0.0000 | 0.0374 | 0.0001 | 0.0001 | 0.0001 | 0.0001 | 0.0002 | ±0.05% | 9,289,664 |
| Fast-Validator | 11.62M | 0.0000 | 0.0276 | 0.0001 | 0.0001 | 0.0001 | 0.0001 | 0.0002 | ±0.03% | 5,809,017 |
| AJV | 7.88M | 0.0000 | 0.3157 | 0.0001 | 0.0002 | 0.0003 | 0.0003 | 0.0003 | ±0.14% | 3,941,102 |
| @kanon/V3.0 | 6.02M | 0.0000 | 0.0182 | 0.0002 | 0.0002 | 0.0003 | 0.0003 | 0.0004 | ±0.04% | 3,011,460 |
| TypeBox | 5.32M | 0.0000 | 0.4100 | 0.0002 | 0.0002 | 0.0003 | 0.0003 | 0.0004 | ±0.43% | 2,660,166 |
| Effect | 2.72M | 0.0000 | 0.3086 | 0.0004 | 0.0005 | 0.0009 | 0.0009 | 0.0010 | ±0.43% | 1,358,322 |
| Valibot | 2.34M | 0.0002 | 0.3663 | 0.0004 | 0.0006 | 0.0008 | 0.0008 | 0.0009 | ±0.31% | 1,168,216 |
| Zod | 2.08M | 0.0002 | 18.9033 | 0.0005 | 0.0005 | 0.0007 | 0.0008 | 0.0009 | ±10.28% | 1,038,614 |
| Superstruct | 453.75K | 0.0015 | 0.2033 | 0.0022 | 0.0025 | 0.0032 | 0.0033 | 0.0040 | ±0.38% | 226,873 |
Payment Form (conditional validation)CRITICAL
| Library | ops/s | min | max | mean | p75 | p99 | p995 | p999 | rme | samples |
|---|---|---|---|---|---|---|---|---|---|---|
| @kanon/JIT 🏆 | 19.57M | 0.0000 | 0.0114 | 0.0001 | 0.0000 | 0.0001 | 0.0001 | 0.0001 | ±0.03% | 9,786,506 |
| AJV | 16.07M | 0.0000 | 0.5031 | 0.0001 | 0.0001 | 0.0001 | 0.0001 | 0.0002 | ±0.20% | 8,036,981 |
| Fast-Validator | 12.53M | 0.0000 | 0.5377 | 0.0001 | 0.0001 | 0.0001 | 0.0001 | 0.0002 | ±0.53% | 6,267,041 |
| @kanon/V3.0 | 5.54M | 0.0000 | 1.1010 | 0.0002 | 0.0002 | 0.0003 | 0.0003 | 0.0004 | ±0.43% | 2,768,177 |
| Zod | 2.62M | 0.0002 | 0.4883 | 0.0004 | 0.0005 | 0.0006 | 0.0006 | 0.0008 | ±0.63% | 1,308,935 |
| TypeBox | 1.74M | 0.0005 | 0.4601 | 0.0006 | 0.0006 | 0.0007 | 0.0008 | 0.0009 | ±0.30% | 870,524 |
| Valibot | 1.68M | 0.0005 | 0.0172 | 0.0006 | 0.0006 | 0.0007 | 0.0008 | 0.0008 | ±0.03% | 841,630 |
| Effect | 861.76K | 0.0009 | 0.2639 | 0.0012 | 0.0012 | 0.0014 | 0.0015 | 0.0017 | ±0.17% | 430,879 |
| Superstruct | 298.76K | 0.0029 | 0.2312 | 0.0033 | 0.0034 | 0.0039 | 0.0041 | 0.0054 | ±0.46% | 149,382 |
Event BookingHIGH
| Library | ops/s | min | max | mean | p75 | p99 | p995 | p999 | rme | samples |
|---|---|---|---|---|---|---|---|---|---|---|
| @kanon/JIT 🏆 | 9.16M | 0.0000 | 0.1130 | 0.0001 | 0.0001 | 0.0002 | 0.0002 | 0.0002 | ±0.06% | 4,581,214 |
| AJV | 4.03M | 0.0000 | 0.3578 | 0.0002 | 0.0003 | 0.0004 | 0.0004 | 0.0005 | ±0.15% | 2,017,384 |
| Fast-Validator | 2.91M | 0.0001 | 0.3994 | 0.0003 | 0.0005 | 0.0006 | 0.0007 | 0.0008 | ±0.48% | 1,452,835 |
| TypeBox | 2.79M | 0.0002 | 0.4330 | 0.0004 | 0.0004 | 0.0005 | 0.0005 | 0.0007 | ±0.36% | 1,394,009 |
| @kanon/V3.0 | 1.65M | 0.0002 | 0.0481 | 0.0006 | 0.0008 | 0.0010 | 0.0011 | 0.0013 | ±0.08% | 822,949 |
| Zod | 839.21K | 0.0005 | 0.4272 | 0.0012 | 0.0015 | 0.0019 | 0.0020 | 0.0023 | ±0.42% | 419,605 |
| Valibot | 686.53K | 0.0007 | 0.3650 | 0.0015 | 0.0018 | 0.0022 | 0.0023 | 0.0027 | ±0.36% | 343,264 |
| Effect | 379.42K | 0.0011 | 0.4886 | 0.0026 | 0.0033 | 0.0045 | 0.0049 | 0.0074 | ±0.63% | 189,713 |
| Superstruct | 120.28K | 0.0041 | 0.3946 | 0.0083 | 0.0102 | 0.0125 | 0.0131 | 0.0197 | ±0.55% | 60,141 |
Invalid Login (error handling)HIGH
| Library | ops/s | min | max | mean | p75 | p99 | p995 | p999 | rme | samples |
|---|---|---|---|---|---|---|---|---|---|---|
| AJV 🏆 | 9.38M | 0.0000 | 0.0644 | 0.0001 | 0.0001 | 0.0002 | 0.0002 | 0.0002 | ±0.08% | 4,690,265 |
| @kanon/JIT | 9.26M | 0.0000 | 0.0189 | 0.0001 | 0.0001 | 0.0002 | 0.0002 | 0.0002 | ±0.03% | 4,627,743 |
| TypeBox | 7.98M | 0.0000 | 0.3721 | 0.0001 | 0.0001 | 0.0002 | 0.0002 | 0.0003 | ±0.46% | 3,988,627 |
| @kanon/V3.0 | 5.76M | 0.0001 | 0.5792 | 0.0002 | 0.0002 | 0.0002 | 0.0003 | 0.0003 | ±0.23% | 2,878,782 |
| Valibot | 2.16M | 0.0002 | 0.4915 | 0.0005 | 0.0005 | 0.0007 | 0.0008 | 0.0009 | ±0.62% | 1,080,612 |
| Fast-Validator | 1.98M | 0.0000 | 0.3687 | 0.0005 | 0.0007 | 0.0012 | 0.0013 | 0.0015 | ±0.42% | 989,654 |
| Effect | 265.91K | 0.0004 | 0.4494 | 0.0038 | 0.0054 | 0.0067 | 0.0070 | 0.0076 | ±0.42% | 132,956 |
| Superstruct | 189.99K | 0.0018 | 20.0408 | 0.0053 | 0.0051 | 0.0075 | 0.0085 | 0.0172 | ±10.70% | 94,996 |
| Zod | 149.75K | 0.0002 | 9.1670 | 0.0067 | 0.0090 | 0.0118 | 0.0127 | 0.0190 | ±6.55% | 74,873 |
Why Kanon JIT is Fast
- JIT Compilation: Schemas are compiled to optimized JavaScript functions at runtime
- No runtime type checks: Types are validated at compile-time by TypeScript
- Minimal abstraction: Direct validation logic, no class hierarchies
- Discriminated unions: O(1) lookup instead of O(n) trial-and-error
A Note on Coercion Performance
On basic coercion operations, Kanon and Zod are roughly equivalent: each wins some benchmarks. This is despite a deliberate architectural difference.
Zod mutates the input directly:
// Zod's approach (simplified)
if (def.coerce) {
payload.value = new Date(payload.value); // mutation!
}
Kanon returns a new value:
// Kanon's approach
if (value instanceof Date) return true;
return { coerced: new Date(value) }; // pure, no mutation
We chose immutability over raw speed because:
- Predictability: Functions don't modify their arguments
- Debugging: Easier to trace where values come from
- Composition: Pure functions compose better
- Safety: No unexpected side-effects
The performance difference is negligible in practice (~0.00001ms per validation), and Kanon still dominates on coercion with constraints (36x faster than Zod on date.max()), which is the common real-world use case.
Reproduce These Results
Want to verify these results? See how to reproduce our data.
Related
- Kanon vs Zod — Full comparison: philosophy, API, migration
- Zygos — Performance — Result pattern benchmarks
- Kanon Module Guide — Full module documentation