Skip to main content
Version: 1.1.4

Benchmark Results

Generated: 2026-06-21 16:30: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.23 µs (19 allocs)4.10 µs (16 allocs)unsupported3.32 µs (26 allocs)unsupported4.99 µs (46 allocs)
Complex8.96 µs (39 allocs)10.21 µs (33 allocs)unsupported9.87 µs (78 allocs)unsupported16.25 µs (153 allocs)

Marshal

Validate + JSON marshal

StructPedantigoPlaygroundOzzoHumaGodanticGodasse
Simple1.75 µs (11 allocs)2.63 µs (9 allocs)unsupportedunsupportedunsupportedunsupported

New

Validator creation overhead

StructPedantigoPlaygroundOzzoHumaGodanticGodasse
Simple11.24 µs (110 allocs)15.07 µs (187 allocs)unsupported29.52 µs (255 allocs)25.55 µs (305 allocs)6.26 µs (72 allocs)
Complex26.75 µs (270 allocs)unsupportedunsupported73.43 µs (515 allocs)7.12 µs (75 allocs)21.83 µs (243 allocs)

OpenAPI

OpenAPI-compatible schema generation

StructPedantigoPlaygroundOzzoHumaGodanticGodasse
Uncached22.18 µs (204 allocs)unsupportedunsupported29.81 µs (255 allocs)unsupportedunsupported
Cached19 ns (0 allocs)unsupportedunsupported587 ns (6 allocs)unsupportedunsupported

Schema

JSON Schema generation

StructPedantigoPlaygroundOzzoHumaGodanticGodasse
Uncached21.36 µs (202 allocs)unsupportedunsupported29.79 µs (255 allocs)unsupportedunsupported
Cached19 ns (0 allocs)unsupportedunsupported596 ns (6 allocs)unsupportedunsupported

Validate

Validate existing struct (no JSON parsing)

StructPedantigoPlaygroundOzzoHumaGodanticGodasse
Simple1.33 µs (10 allocs)2.10 µs (7 allocs)11.82 µs (43 allocs)unsupported5.44 µs (48 allocs)unsupported
Complex2.20 µs (15 allocs)3.38 µs (9 allocs)11.40 µs (139 allocs)unsupported12.47 µs (120 allocs)unsupported
Large1.43 µs (22 allocs)1.66 µs (3 allocs)42.77 µs (254 allocs)unsupported13.39 µs (126 allocs)unsupported

Summary

Validate_Simple (struct validation)

Libraryns/opallocsvs Pedantigo
Pedantigo1.33 µs10baseline
Playground2.10 µs71.58x slower
Ozzo11.82 µs438.91x slower
Huma---
Godantic5.44 µs484.10x slower
Godasse---

Validate_Complex (nested structs)

Libraryns/opallocsvs Pedantigo
Pedantigo2.20 µs15baseline
Playground3.38 µs91.54x slower
Ozzo11.40 µs1395.19x slower
Huma---
Godantic12.47 µs1205.68x slower
Godasse---

JSONValidate_Simple (JSON → struct + validate)

Libraryns/opallocsvs Pedantigo
Pedantigo3.23 µs19baseline
Playground4.10 µs161.27x slower
Ozzo---
Huma3.32 µs261.03x slower
Godantic---
Godasse4.99 µs461.55x slower

JSONValidate_Complex (nested JSON)

Libraryns/opallocsvs Pedantigo
Pedantigo8.96 µs39baseline
Playground10.21 µs331.14x slower
Ozzo---
Huma9.87 µs781.10x slower
Godantic---
Godasse16.25 µs1531.81x slower

Schema_Uncached (first-time generation)

Libraryns/opallocsvs Pedantigo
Pedantigo21.36 µs202baseline
Playground---
Ozzo---
Huma29.79 µs2551.40x slower
Godantic---
Godasse---

Schema_Cached (cached lookup)

Libraryns/opallocsvs Pedantigo
Pedantigo19 ns0baseline
Playground---
Ozzo---
Huma596 ns631.16x 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)