Skip to main content

performance benchmarks Kanon Performance Benchmarks

Real-world validation benchmarks. Data auto-generated on Jan 31, 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:

  1. Creates a pool of 10,000 test objects
  2. Runs validation in a tight loop
  3. Measures operations per second with statistical analysis
  4. Reports min, max, mean, percentiles (p75, p99, p995, p999)
  5. 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?WeightDescriptionExamples
CRITICAL
A lot
5 ptsHot path functions called in tight loopsmap, filter, reduce, groupBy, chunk
HIGH
Yes
3 ptsFrequently used utilities, but not in tight loopsget, set, pick, omit, cloneDeep
MEDIUM
A bit
1 ptOccasional utilitiesType guards (isArray, isString), string formatting
LOW
No
0.5 ptsSetup-only functions where runtime perf is irrelevantdebounce, throttle, once, memoize

This scoring gives a more realistic picture of which library will actually make your app faster.


Libraries Tested

LibraryVersionDescription
@sinclair/typebox0.34.47JSON Schema with TypeScript inference + JIT
ajv8.17.1JSON Schema validator with JIT compilation
fastest-validator1.19.1High-performance validator with JIT
kanon1.1.0Pithos validation module (schema-first + JIT)
superstruct2.0.2Composable validation with custom types
valibot1.2.0Modular schema validation, tree-shakable
zod4.3.5Schema-first validation with TypeScript inference
Benchmarks run on Jan 31, 2026

Benchmark Results

Test@kanon/V3.0@kanon/JITAJVFast-ValidatorSuperstructTypeBoxValibotZod
Critical
Login Form Validation
CRITICAL | 5 pts
7.47M ops/s
(2.04x)
9.83M ops/s
(1.55x)
8.64M ops/s
(1.76x)
9.96M ops/s
(1.53x)
596.04K ops/s
(25.54x)
15.22M ops/s
fastest
3.33M ops/s
(4.57x)
4.91M ops/s
(3.1x)
Payment Form (conditional validation)
CRITICAL | 5 pts
5.68M ops/s
(3.15x)
17.91M ops/s
fastest
15.38M ops/s
(1.16x)
12.02M ops/s
(1.49x)
285.12K ops/s
(62.8x)
1.70M ops/s
(10.5x)
1.69M ops/s
(10.58x)
2.63M ops/s
(6.82x)
User Registration (with password confirm)
CRITICAL | 5 pts
5.13M ops/s
(1.71x)
5.93M ops/s
(1.48x)
6.74M ops/s
(1.3x)
6.81M ops/s
(1.29x)
297.83K ops/s
(29.46x)
8.77M ops/s
fastest
1.64M ops/s
(5.36x)
2.04M ops/s
(4.31x)
High
API Response (discriminated union)
HIGH | 3 pts
8.26M ops/s
(3.45x)
28.51M ops/s
fastest
17.82M ops/s
(1.6x)
14.45M ops/s
(1.97x)
373.72K ops/s
(76.29x)
3.35M ops/s
(8.51x)
2.41M ops/s
(11.81x)
8.18M ops/s
(3.48x)
Blog Post with Comments
HIGH | 3 pts
2.57M ops/s
(2.38x)
6.10M ops/s
fastest
4.91M ops/s
(1.24x)
3.41M ops/s
(1.79x)
108.24K ops/s
(56.32x)
1.48M ops/s
(4.12x)
767.56K ops/s
(7.94x)
1.50M ops/s
(4.07x)
E-commerce Product
HIGH | 3 pts
4.93M ops/s
(2.75x)
13.57M ops/s
fastest
12.30M ops/s
(1.1x)
11.84M ops/s
(1.15x)
194.48K ops/s
(69.79x)
1.12M ops/s
(12.07x)
1.38M ops/s
(9.82x)
2.65M ops/s
(5.13x)
Event Booking
HIGH | 3 pts
1.50M ops/s
(5.69x)
8.55M ops/s
fastest
3.60M ops/s
(2.38x)
2.80M ops/s
(3.05x)
113.39K ops/s
(75.41x)
2.06M ops/s
(4.15x)
678.20K ops/s
(12.61x)
812.84K ops/s
(10.52x)
Invalid Login (error handling)
HIGH | 3 pts
5.57M ops/s
(1.67x)
8.81M ops/s
(1.06x)
9.32M ops/s
fastest
1.98M ops/s
(4.71x)
235.84K ops/s
(39.5x)
7.76M ops/s
(1.2x)
2.15M ops/s
(4.34x)
142.30K ops/s
(65.46x)
Medium
Search Params (with coercion)
MEDIUM | 1 pts
4.27M ops/s
(5.61x)
23.95M ops/s
fastest
22.18M ops/s
(1.08x)
17.43M ops/s
(1.37x)
188.97K ops/s
(126.74x)
1.95M ops/s
(12.27x)
1.77M ops/s
(13.51x)
4.38M ops/s
(5.47x)
User Profile Update (optional fields)
MEDIUM | 1 pts
5.98M ops/s
(3.21x)
19.21M ops/s
fastest
7.80M ops/s
(2.46x)
11.33M ops/s
(1.7x)
425.89K ops/s
(45.1x)
5.25M ops/s
(3.66x)
2.30M ops/s
(8.34x)
2.60M ops/s
(7.4x)
Data generated on Jan 31, 2026 • Vitest bench

📊 Performance Summary

first@kanon/JIT
7 wins
secondTypeBox
2 wins
thirdAJV
1 wins
@kanon/V3.0
0 wins
Zod
0 wins
Valibot
0 wins
Superstruct
0 wins
Fast-Validator
0 wins

📈 Weighted Summary

🏆 @kanon/JIT dominates real-world scenarios!

first@kanon/JIT
66%(27 pts)
secondTypeBox
24%(10 pts)
thirdAJV
10%(4 pts)
@kanon/V3.0
0%(0 pts)
Zod
0%(0 pts)
Valibot
0%(0 pts)
Superstruct
0%(0 pts)
Fast-Validator
0%(0 pts)

On 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
Libraryops/sminmaxmeanp75p99p995p999rmesamples
TypeBox 🏆15.22M0.00000.01970.00010.00010.00010.00010.0002±0.07%7,611,730
Fast-Validator9.96M0.00000.02420.00010.00010.00010.00010.0002±0.07%4,979,899
@kanon/JIT9.83M0.00000.02750.00010.00010.00010.00010.0002±0.06%4,914,072
AJV8.64M0.00000.44070.00010.00010.00020.00020.0002±0.19%4,318,839
@kanon/V3.07.47M0.00000.02670.00010.00010.00020.00020.0003±0.06%3,732,849
Zod4.91M0.00010.23800.00020.00020.00030.00030.0004±0.21%2,453,001
Valibot3.33M0.00020.30370.00030.00030.00040.00040.0005±0.27%1,665,585
Superstruct596.04K0.00140.29550.00170.00160.00210.00220.0085±0.58%298,023
User Registration (with password confirm)CRITICAL
Libraryops/sminmaxmeanp75p99p995p999rmesamples
TypeBox 🏆8.77M0.00000.51070.00010.00010.00010.00020.0003±0.68%4,387,058
Fast-Validator6.81M0.00000.70600.00010.00020.00020.00020.0004±0.57%3,405,163
AJV6.74M0.00000.31640.00010.00020.00020.00020.0003±0.14%3,369,058
@kanon/JIT5.93M0.00000.02740.00020.00020.00020.00020.0003±0.06%2,964,740
@kanon/V3.05.13M0.00010.02740.00020.00020.00020.00030.0003±0.08%2,564,632
Zod2.04M0.00030.55490.00050.00050.00060.00070.0011±0.52%1,018,048
Valibot1.64M0.00050.38630.00060.00060.00080.00080.0010±0.21%818,343
Superstruct297.83K0.00300.30870.00340.00330.00400.00480.0157±0.55%148,916
API Response (discriminated union)HIGH
Libraryops/sminmaxmeanp75p99p995p999rmesamples
@kanon/JIT 🏆28.51M0.00000.04100.00000.00000.00000.00000.0001±0.08%14,254,971
AJV17.82M0.00000.39530.00010.00010.00010.00010.0002±0.52%8,908,332
Fast-Validator14.45M0.00000.03240.00010.00010.00010.00010.0001±0.06%7,225,420
@kanon/V3.08.26M0.00000.05850.00010.00010.00020.00020.0002±0.09%4,131,690
Zod8.18M0.00000.23040.00010.00010.00020.00020.0003±0.26%4,091,166
TypeBox3.35M0.00020.32920.00030.00030.00040.00040.0005±0.24%1,675,506
Valibot2.41M0.00020.94930.00040.00050.00050.00060.0011±0.51%1,206,584
Superstruct373.72K0.00190.24550.00270.00350.00390.00420.0099±0.45%186,858
E-commerce ProductHIGH
Libraryops/sminmaxmeanp75p99p995p999rmesamples
@kanon/JIT 🏆13.57M0.00000.05970.00010.00010.00010.00010.0002±0.09%6,786,147
AJV12.30M0.00000.64680.00010.00010.00010.00010.0002±0.34%6,152,443
Fast-Validator11.84M0.00000.52600.00010.00010.00010.00010.0002±0.49%5,921,945
@kanon/V3.04.93M0.00010.02250.00020.00020.00030.00030.0004±0.07%2,465,677
Zod2.65M0.00020.39210.00040.00040.00050.00060.0007±0.50%1,323,052
Valibot1.38M0.00060.37560.00070.00080.00090.00100.0011±0.36%691,078
TypeBox1.12M0.00070.48920.00090.00100.00110.00120.0045±0.35%562,330
Superstruct194.48K0.00430.25810.00510.00540.00610.00660.0150±0.51%97,242
Blog Post with CommentsHIGH
Libraryops/sminmaxmeanp75p99p995p999rmesamples
@kanon/JIT 🏆6.10M0.00000.10390.00020.00020.00020.00020.0003±0.11%3,047,916
AJV4.91M0.00010.63540.00020.00020.00030.00030.0005±0.28%2,457,042
Fast-Validator3.41M0.00010.35400.00030.00030.00050.00060.0027±0.25%1,707,302
@kanon/V3.02.57M0.00020.03830.00040.00050.00050.00050.0007±0.08%1,283,142
Zod1.50M0.00040.36130.00070.00070.00090.00100.0011±0.43%748,702
TypeBox1.48M0.00050.48400.00070.00070.00080.00080.0012±0.38%738,933
Valibot767.56K0.00070.29010.00130.00150.00180.00190.0023±0.32%383,779
Superstruct108.24K0.00530.23120.00920.01080.01330.01570.0365±0.52%54,122
Search Params (with coercion)MEDIUM
Libraryops/sminmaxmeanp75p99p995p999rmesamples
@kanon/JIT 🏆23.95M0.00000.13360.00000.00000.00010.00010.0001±0.10%11,975,044
AJV22.18M0.00000.07990.00000.00000.00010.00010.0001±0.11%11,089,245
Fast-Validator17.43M0.00000.04450.00010.00010.00010.00010.0002±0.08%8,712,950
Zod4.38M0.00010.35790.00020.00020.00030.00030.0005±0.47%2,188,594
@kanon/V3.04.27M0.00015.02600.00020.00020.00030.00030.0004±7.22%2,135,965
TypeBox1.95M0.00040.54760.00050.00050.00060.00070.0009±0.34%975,622
Valibot1.77M0.00040.75920.00060.00050.00070.00090.0044±0.55%886,359
Superstruct188.97K0.00483.64180.00530.00520.00760.00890.0157±1.58%94,487
User Profile Update (optional fields)MEDIUM
Libraryops/sminmaxmeanp75p99p995p999rmesamples
@kanon/JIT 🏆19.21M0.00000.47850.00010.00000.00010.00010.0002±0.26%9,604,854
Fast-Validator11.33M0.00000.04630.00010.00010.00010.00010.0002±0.09%5,664,294
AJV7.80M0.00000.45400.00010.00020.00030.00030.0004±0.21%3,899,045
@kanon/V3.05.98M0.00000.08620.00020.00020.00030.00030.0004±0.11%2,989,174
TypeBox5.25M0.00000.44480.00020.00020.00030.00030.0004±0.44%2,623,700
Zod2.60M0.00010.55830.00040.00050.00070.00070.0010±0.52%1,298,461
Valibot2.30M0.00020.36100.00040.00060.00080.00080.0010±0.31%1,151,993
Superstruct425.89K0.00151.82130.00230.00260.00450.00600.0112±1.02%212,946
Payment Form (conditional validation)CRITICAL
Libraryops/sminmaxmeanp75p99p995p999rmesamples
@kanon/JIT 🏆17.91M0.00000.63500.00010.00010.00010.00010.0001±0.31%8,953,211
AJV15.38M0.00000.74950.00010.00010.00010.00010.0002±0.31%7,689,555
Fast-Validator12.02M0.00000.52620.00010.00010.00010.00010.0002±0.61%6,009,955
@kanon/V3.05.68M0.00000.06780.00020.00020.00030.00030.0003±0.10%2,839,275
Zod2.63M0.00020.89040.00040.00050.00050.00060.0036±0.81%1,312,783
TypeBox1.70M0.00050.35460.00060.00060.00070.00080.0012±0.18%852,429
Valibot1.69M0.00050.04260.00060.00060.00070.00070.0024±0.09%846,324
Superstruct285.12K0.00290.53930.00350.00350.00450.00720.0146±0.64%142,558
Event BookingHIGH
Libraryops/sminmaxmeanp75p99p995p999rmesamples
@kanon/JIT 🏆8.55M0.00000.03490.00010.00010.00010.00020.0002±0.07%4,275,359
AJV3.60M0.00001.91460.00030.00030.00050.00050.0007±1.64%1,799,473
Fast-Validator2.80M0.00000.50010.00040.00040.00060.00070.0042±0.65%1,401,667
TypeBox2.06M0.000218.54850.00050.00040.00080.00100.0043±10.22%1,031,067
@kanon/V3.01.50M0.00024.24040.00070.00080.00130.00180.0070±2.14%751,065
Zod812.84K0.00040.66440.00120.00150.00380.00490.0107±0.79%406,419
Valibot678.20K0.00070.53150.00150.00180.00250.00500.0102±0.58%339,102
Superstruct113.39K0.00410.65000.00880.01060.01700.02110.0648±0.89%56,694
Invalid Login (error handling)HIGH
Libraryops/sminmaxmeanp75p99p995p999rmesamples
AJV 🏆9.32M0.00000.05130.00010.00010.00020.00020.0002±0.08%4,657,623
@kanon/JIT8.81M0.00000.03380.00010.00010.00020.00020.0002±0.07%4,404,544
TypeBox7.76M0.00000.48420.00010.00010.00020.00020.0003±0.64%3,877,990
@kanon/V3.05.57M0.00005.00550.00020.00020.00020.00020.0003±2.51%2,785,167
Valibot2.15M0.00020.49900.00050.00050.00070.00080.0037±0.64%1,072,991
Fast-Validator1.98M0.00000.32490.00050.00070.00120.00130.0015±0.45%988,404
Superstruct235.84K0.00170.47630.00420.00510.00690.00860.0119±0.52%117,918
Zod142.30K0.00025.72750.00700.00950.01350.01600.0255±5.21%71,151

Why Kanon JIT is Fast

  1. JIT Compilation: Schemas are compiled to optimized JavaScript functions at runtime
  2. No runtime type checks: Types are validated at compile-time by TypeScript
  3. Minimal abstraction: Direct validation logic, no class hierarchies
  4. 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