Skip to main content
Version: 1.1.3

Benchmark Results

Generated: 2026-02-04 11:01:32 UTC

If you're interested in diving deeper, check out our benchmark repository.

Library Notes

Feature Comparison

FeaturePedantigoPlaygroundOzzoHumaGodanticGodasse
Declarative constraints✅ tags✅ tags✅ rules✅ tags✅ methods❌ hand-written
JSON Schema generation
Default values
Unmarshal + validate
Validate existing struct❌*

*Godasse requires hand-written Validate() methods

Library Descriptions

  1. Pedantigo - Struct tag-based validation (validate:"required,email,min=5"). JSON Schema generation with caching.

  2. Playground (go-playground/validator) - Struct tag-based validation. Rich constraint library, no JSON Schema.

  3. Ozzo (ozzo-validation) - Rule builder API (validation.Field(&u.Name, validation.Required, validation.Length(2,100))). No struct tags.

  4. Huma - OpenAPI-focused. Validates map[string]any against schemas, not structs directly.

  5. Godantic - Method-based constraints (FieldName() FieldOptions[T]). JSON Schema, defaults, streaming partial JSON.

  6. Godasse - Deserializer with default: tag. All constraint validation requires hand-written Validate() methods.


JSONValidate

JSON bytes → struct + validate

StructPedantigoPlaygroundOzzoHumaGodanticGodasse
Simple3.49 µs (19 allocs)4.25 µs (16 allocs)unsupported3.57 µs (26 allocs)unsupported5.50 µs (46 allocs)
Complex9.90 µs (39 allocs)11.04 µs (33 allocs)unsupported10.48 µs (78 allocs)unsupported17.83 µs (153 allocs)

Marshal

Validate + JSON marshal

StructPedantigoPlaygroundOzzoHumaGodanticGodasse
Simple1.90 µs (11 allocs)2.82 µs (9 allocs)unsupportedunsupportedunsupportedunsupported

New

Validator creation overhead

StructPedantigoPlaygroundOzzoHumaGodanticGodasse
Simple12.01 µs (110 allocs)16.29 µs (187 allocs)unsupported32.29 µs (255 allocs)27.51 µs (305 allocs)6.94 µs (72 allocs)
Complex28.90 µs (270 allocs)unsupportedunsupported77.85 µs (515 allocs)7.80 µs (75 allocs)23.96 µs (243 allocs)

OpenAPI

OpenAPI-compatible schema generation

StructPedantigoPlaygroundOzzoHumaGodanticGodasse
Uncached24.20 µs (204 allocs)unsupportedunsupported32.04 µs (255 allocs)unsupportedunsupported
Cached20 ns (0 allocs)unsupportedunsupported640 ns (6 allocs)unsupportedunsupported

Schema

JSON Schema generation

StructPedantigoPlaygroundOzzoHumaGodanticGodasse
Uncached23.28 µs (202 allocs)unsupportedunsupported32.41 µs (255 allocs)unsupportedunsupported
Cached21 ns (0 allocs)unsupportedunsupported640 ns (6 allocs)unsupportedunsupported

Validate

Validate existing struct (no JSON parsing)

StructPedantigoPlaygroundOzzoHumaGodanticGodasse
Simple1.55 µs (10 allocs)2.18 µs (7 allocs)13.15 µs (43 allocs)unsupported6.05 µs (48 allocs)unsupported
Complex2.38 µs (15 allocs)3.57 µs (9 allocs)12.52 µs (139 allocs)unsupported14.25 µs (120 allocs)unsupported
Large1.65 µs (22 allocs)1.89 µs (3 allocs)48.01 µs (254 allocs)unsupported14.78 µs (126 allocs)unsupported

Summary

Validate_Simple (struct validation)

Libraryns/opallocsvs Pedantigo
Pedantigo1.55 µs10baseline
Playground2.18 µs71.41x slower
Ozzo13.15 µs438.49x slower
Huma---
Godantic6.05 µs483.91x slower
Godasse---

Validate_Complex (nested structs)

Libraryns/opallocsvs Pedantigo
Pedantigo2.38 µs15baseline
Playground3.57 µs91.50x slower
Ozzo12.52 µs1395.27x slower
Huma---
Godantic14.25 µs1205.99x slower
Godasse---

JSONValidate_Simple (JSON → struct + validate)

Libraryns/opallocsvs Pedantigo
Pedantigo3.49 µs19baseline
Playground4.25 µs161.22x slower
Ozzo---
Huma3.57 µs261.02x slower
Godantic---
Godasse5.50 µs461.58x slower

JSONValidate_Complex (nested JSON)

Libraryns/opallocsvs Pedantigo
Pedantigo9.90 µs39baseline
Playground11.04 µs331.12x slower
Ozzo---
Huma10.48 µs781.06x slower
Godantic---
Godasse17.83 µs1531.80x slower

Schema_Uncached (first-time generation)

Libraryns/opallocsvs Pedantigo
Pedantigo23.28 µs202baseline
Playground---
Ozzo---
Huma32.41 µs2551.39x slower
Godantic---
Godasse---

Schema_Cached (cached lookup)

Libraryns/opallocsvs Pedantigo
Pedantigo21 ns0baseline
Playground---
Ozzo---
Huma640 ns631.01x slower
Godantic---
Godasse---

Generated by pedantigo-benchmarks

Benchmark naming convention
Benchmark_<Library>_<Feature>_<Struct>

Libraries: Pedantigo, Playground, Ozzo, Huma, Godantic, Godasse
Features: Validate, JSONValidate, New, Schema, OpenAPI, Marshal
Structs: Simple (5 fields), Complex (nested), Large (20+ fields)