Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

README.md

Benchmark Suite

A benchmarking suite for comparing different Rust JSON Schema implementations.

Implementations

Usage

To run the benchmarks:

$ cargo bench

Overview

Benchmark Description Schema Size Instance Size
OpenAPI Zuora API validated against OpenAPI 3.0 schema 18 KB 4.5 MB
Swagger Kubernetes API (v1.10.0) with Swagger schema 25 KB 3.0 MB
GeoJSON Canadian border in GeoJSON format 4.8 KB 2.1 MB
CITM Concert data catalog with inferred schema 2.3 KB 501 KB
Fast From fastjsonschema benchmarks (valid/invalid) 595 B 55 B / 60 B
FHIR Patient example validated against FHIR schema 3.3 MB 2.1 KB
Recursive Nested data with $dynamicRef 1.4 KB 449 B

Sources:

Results

Comparison with Other Libraries

Benchmark jsonschema_valid valico boon jsonschema (validate)
OpenAPI - - 7.05 ms (x5.83) 1.21 ms
Swagger - 110.63 ms (x83.18) 10.27 ms (x7.72) 1.33 ms
GeoJSON 16.44 ms (x31.00) 323.62 ms (x610.26) 19.08 ms (x35.98) 530.30 µs
CITM Catalog 2.45 ms (x6.15) 28.33 ms (x71.15) 1.06 ms (x2.66) 398.17 µs
Fast (Valid) 928.88 ns (x13.88) 3.34 µs (x49.91) 327.17 ns (x4.89) 66.92 ns
Fast (Invalid) 209.16 ns (x6.21) 3.42 µs (x101.51) 394.97 ns (x11.72) 33.69 ns
FHIR 590.04 ms (x173032.26) 1.68 ms (x492.67) 179.24 µs (x52.56) 3.41 µs
Recursive - - 28.48 ms (x5595.28) 5.09 µs

Notes:

  1. jsonschema_valid and valico do not handle valid path instances matching the ^\\/ regex.

  2. jsonschema_valid fails to resolve local references (e.g. #/definitions/definitions) in OpenAPI/Swagger schemas.

  3. jsonschema_valid and valico fail to resolve local references in the Recursive schema.

You can find benchmark code in benches/ and in the main jsonschema crate. Rust version is 1.92.

Contributing

Contributions to improve, expand, or optimize the benchmark suite are welcome. This includes adding new benchmarks, ensuring fair representation of real-world use cases, and optimizing the configuration and usage of benchmarked libraries. Such efforts are highly appreciated as they ensure accurate and meaningful performance comparisons.