Skip to main content

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:

  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.48JSON Schema with TypeScript inference + JIT
ajv8.18.0JSON Schema validator with JIT compilation
effect3.19.19Full-featured TypeScript library with schema validation
fastest-validator1.19.1High-performance validator with JIT
kanon2.3.0Pithos validation module (schema-first + JIT)
superstruct2.0.2Composable validation with custom types
valibot1.2.0Modular schema validation, tree-shakable
zod4.3.6Schema-first validation with TypeScript inference
Benchmarks run on Mar 14, 2026

Benchmark Results

Test@kanon/V3.0@kanon/JITAJVEffectFast-ValidatorSuperstructTypeBoxValibotZod
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)
Data generated on Mar 14, 2026 • Vitest bench

📊 Performance Summary

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

📈 Weighted Summary

🏆 @kanon/JIT dominates real-world scenarios!

first@kanon/JIT
59%(24 pts)
secondTypeBox
24%(10 pts)
thirdAJV
17%(7 pts)
@kanon/V3.0
0%(0 pts)
Zod
0%(0 pts)
Valibot
0%(0 pts)
Superstruct
0%(0 pts)
Effect
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 🏆16.22M0.00000.01600.00010.00010.00010.00010.0002±0.03%8,110,826
@kanon/JIT10.75M0.00000.02510.00010.00010.00010.00010.0002±0.02%5,375,293
Fast-Validator10.30M0.00000.01930.00010.00010.00010.00010.0002±0.03%5,151,905
AJV8.85M0.00000.34770.00010.00010.00010.00020.0002±0.14%4,426,595
@kanon/V3.07.30M0.00000.03340.00010.00020.00020.00020.0003±0.04%3,649,270
Zod4.84M0.00010.31600.00020.00020.00030.00030.0005±0.28%2,418,545
Valibot3.35M0.00020.35570.00030.00030.00040.00040.0005±0.33%1,673,937
Effect2.69M0.00020.31950.00040.00040.00050.00050.0007±0.44%1,345,564
Superstruct606.72K0.00140.30600.00160.00160.00210.00220.0028±0.61%303,362
User Registration (with password confirm)CRITICAL
Libraryops/sminmaxmeanp75p99p995p999rmesamples
TypeBox 🏆9.21M0.00000.33710.00010.00010.00010.00020.0003±0.48%4,605,625
AJV6.95M0.00000.24340.00010.00020.00020.00020.0003±0.10%3,473,459
Fast-Validator6.91M0.00000.73370.00010.00020.00020.00020.0003±0.53%3,456,964
@kanon/JIT6.37M0.00000.01930.00020.00020.00020.00020.0003±0.03%3,183,797
@kanon/V3.05.04M0.00010.01200.00020.00020.00030.00030.0003±0.02%2,519,971
Zod1.96M0.00040.57190.00050.00050.00070.00070.0010±0.71%978,593
Valibot1.68M0.00050.46110.00060.00060.00070.00070.0008±0.45%840,156
Effect1.04M0.00080.36440.00100.00100.00120.00120.0014±0.40%522,297
Superstruct302.28K0.00290.42560.00330.00330.00390.00410.0056±0.60%151,139
API Response (discriminated union)HIGH
Libraryops/sminmaxmeanp75p99p995p999rmesamples
@kanon/JIT 🏆26.14M0.00000.03100.00000.00000.00000.00010.0001±0.03%13,069,900
AJV18.93M0.00000.40320.00010.00000.00010.00010.0002±0.43%9,466,101
Fast-Validator15.24M0.00000.97560.00010.00010.00010.00010.0002±0.38%7,620,768
@kanon/V3.08.54M0.00000.01260.00010.00010.00010.00020.0002±0.02%4,271,265
Zod8.23M0.00000.34930.00010.00010.00020.00020.0003±0.38%4,117,143
TypeBox3.38M0.00020.34170.00030.00030.00040.00040.0005±0.34%1,688,336
Effect2.88M0.00020.32280.00030.00030.00050.00050.0007±0.49%1,440,551
Valibot2.40M0.00030.30290.00040.00050.00050.00060.0006±0.16%1,201,783
Superstruct374.49K0.00200.39140.00270.00340.00390.00400.0050±0.55%187,246
E-commerce ProductHIGH
Libraryops/sminmaxmeanp75p99p995p999rmesamples
@kanon/JIT 🏆14.40M0.00000.03720.00010.00010.00010.00010.0002±0.03%7,201,078
AJV12.74M0.00000.01090.00010.00010.00010.00010.0002±0.02%6,371,751
Fast-Validator12.47M0.00000.46010.00010.00010.00010.00010.0002±0.40%6,237,172
@kanon/V3.04.93M0.00010.05440.00020.00020.00030.00030.0004±0.04%2,462,980
Zod2.58M0.00030.45240.00040.00040.00050.00060.0007±0.50%1,292,474
Valibot1.39M0.00050.36060.00070.00080.00090.00100.0011±0.40%697,498
TypeBox1.13M0.00070.48930.00090.00100.00110.00110.0013±0.19%566,269
Effect803.89K0.00100.27530.00120.00130.00150.00160.0018±0.50%401,946
Superstruct198.25K0.00430.34900.00500.00530.00600.00630.0091±0.51%99,123
Blog Post with CommentsHIGH
Libraryops/sminmaxmeanp75p99p995p999rmesamples
@kanon/JIT 🏆6.70M0.00000.02700.00010.00020.00020.00020.0003±0.05%3,347,674
AJV5.09M0.00010.42450.00020.00020.00030.00030.0003±0.17%2,545,400
Fast-Validator3.64M0.00010.50380.00030.00030.00040.00050.0006±0.20%1,822,243
@kanon/V3.02.53M0.00020.01800.00040.00050.00050.00060.0007±0.04%1,267,014
TypeBox1.49M0.00050.41780.00070.00070.00080.00080.0010±0.32%746,601
Zod1.48M0.00050.41180.00070.00070.00100.00100.0012±0.47%740,333
Valibot794.08K0.00070.32970.00130.00150.00180.00190.0022±0.36%397,041
Effect570.87K0.00120.30740.00180.00200.00240.00250.0029±0.45%285,436
Superstruct110.87K0.00530.26140.00900.01050.01360.01600.0328±0.50%55,436
Search Params (with coercion)MEDIUM
Libraryops/sminmaxmeanp75p99p995p999rmesamples
AJV 🏆23.43M0.00000.58130.00000.00000.00010.00010.0001±0.30%11,715,355
@kanon/JIT23.37M0.00000.03420.00000.00000.00010.00010.0001±0.03%11,685,828
Fast-Validator18.07M0.00000.01950.00010.00010.00010.00010.0001±0.03%9,033,883
@kanon/V3.05.05M0.00010.37210.00020.00020.00020.00030.0004±0.45%2,525,489
Zod4.19M0.00010.57480.00020.00020.00030.00040.0005±0.54%2,097,472
TypeBox2.01M0.00040.45980.00050.00050.00060.00060.0007±0.28%1,002,752
Valibot1.77M0.00050.28430.00060.00060.00070.00070.0009±0.23%884,974
Effect1.36M0.00060.39480.00070.00080.00090.00100.0011±0.41%678,193
Superstruct190.53K0.00482.75600.00520.00520.00790.00820.0096±1.31%95,268
User Profile Update (optional fields)MEDIUM
Libraryops/sminmaxmeanp75p99p995p999rmesamples
@kanon/JIT 🏆18.58M0.00000.03740.00010.00010.00010.00010.0002±0.05%9,289,664
Fast-Validator11.62M0.00000.02760.00010.00010.00010.00010.0002±0.03%5,809,017
AJV7.88M0.00000.31570.00010.00020.00030.00030.0003±0.14%3,941,102
@kanon/V3.06.02M0.00000.01820.00020.00020.00030.00030.0004±0.04%3,011,460
TypeBox5.32M0.00000.41000.00020.00020.00030.00030.0004±0.43%2,660,166
Effect2.72M0.00000.30860.00040.00050.00090.00090.0010±0.43%1,358,322
Valibot2.34M0.00020.36630.00040.00060.00080.00080.0009±0.31%1,168,216
Zod2.08M0.000218.90330.00050.00050.00070.00080.0009±10.28%1,038,614
Superstruct453.75K0.00150.20330.00220.00250.00320.00330.0040±0.38%226,873
Payment Form (conditional validation)CRITICAL
Libraryops/sminmaxmeanp75p99p995p999rmesamples
@kanon/JIT 🏆19.57M0.00000.01140.00010.00000.00010.00010.0001±0.03%9,786,506
AJV16.07M0.00000.50310.00010.00010.00010.00010.0002±0.20%8,036,981
Fast-Validator12.53M0.00000.53770.00010.00010.00010.00010.0002±0.53%6,267,041
@kanon/V3.05.54M0.00001.10100.00020.00020.00030.00030.0004±0.43%2,768,177
Zod2.62M0.00020.48830.00040.00050.00060.00060.0008±0.63%1,308,935
TypeBox1.74M0.00050.46010.00060.00060.00070.00080.0009±0.30%870,524
Valibot1.68M0.00050.01720.00060.00060.00070.00080.0008±0.03%841,630
Effect861.76K0.00090.26390.00120.00120.00140.00150.0017±0.17%430,879
Superstruct298.76K0.00290.23120.00330.00340.00390.00410.0054±0.46%149,382
Event BookingHIGH
Libraryops/sminmaxmeanp75p99p995p999rmesamples
@kanon/JIT 🏆9.16M0.00000.11300.00010.00010.00020.00020.0002±0.06%4,581,214
AJV4.03M0.00000.35780.00020.00030.00040.00040.0005±0.15%2,017,384
Fast-Validator2.91M0.00010.39940.00030.00050.00060.00070.0008±0.48%1,452,835
TypeBox2.79M0.00020.43300.00040.00040.00050.00050.0007±0.36%1,394,009
@kanon/V3.01.65M0.00020.04810.00060.00080.00100.00110.0013±0.08%822,949
Zod839.21K0.00050.42720.00120.00150.00190.00200.0023±0.42%419,605
Valibot686.53K0.00070.36500.00150.00180.00220.00230.0027±0.36%343,264
Effect379.42K0.00110.48860.00260.00330.00450.00490.0074±0.63%189,713
Superstruct120.28K0.00410.39460.00830.01020.01250.01310.0197±0.55%60,141
Invalid Login (error handling)HIGH
Libraryops/sminmaxmeanp75p99p995p999rmesamples
AJV 🏆9.38M0.00000.06440.00010.00010.00020.00020.0002±0.08%4,690,265
@kanon/JIT9.26M0.00000.01890.00010.00010.00020.00020.0002±0.03%4,627,743
TypeBox7.98M0.00000.37210.00010.00010.00020.00020.0003±0.46%3,988,627
@kanon/V3.05.76M0.00010.57920.00020.00020.00020.00030.0003±0.23%2,878,782
Valibot2.16M0.00020.49150.00050.00050.00070.00080.0009±0.62%1,080,612
Fast-Validator1.98M0.00000.36870.00050.00070.00120.00130.0015±0.42%989,654
Effect265.91K0.00040.44940.00380.00540.00670.00700.0076±0.42%132,956
Superstruct189.99K0.001820.04080.00530.00510.00750.00850.0172±10.70%94,996
Zod149.75K0.00029.16700.00670.00900.01180.01270.0190±6.55%74,873

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