Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

README.md

json-schema-benchmark (draft4)

Performance benchmark for Node.js JSON-schema validators.

Also tests against official JSON-schema test suite, version draft4. and checks for validators that cause side-effects on schema or data. The top 6 validators that fail the least tests are included in the benchmark.

Contribute to these benchmarks

Performance

performance

Validator Relative speed Number of test runs per second
ajv 100% 18434 (± 1.13%)
@exodus/schemasafe 70.2% 12937 (± 3.11%)
is-my-json-valid 46.9% 8643 (± 1.25%)
z-schema 6.5% 1207 (± 0.55%)
@cfworker/json-schema 5.3% 982 (± 1.64%)
jsonschema 1.2% 227 (± 0.35%)

692 tests are run in each test run.

Validators tested: @exodus/schemasafe (1.0.0-rc.3), @cfworker/json-schema (1.6.3), jsonschema (1.4.0), z-schema (5.0.0), ajv (6.12.6), is-my-json-valid (2.20.5), jsen (0.6.6), json-schema-library (4.1.4), jsck (0.3.2), themis (1.1.6), tv4 (1.3.0), skeemas (1.2.5), schemasaurus (0.7.8), request-validator (0.3.3), djv (2.1.3-alpha.0), jassi (0.1.2), jjv (1.0.2), json-schema-validator-generator (1.1.11), json-model (0.2.24), JSV (4.0.2), json-gate (0.8.23), revalidator (0.3.1),

(validators not in the results above where excluded because of failing tests - see below for details)

ajv is currently the fastest JSON-schema validator out there.

Test failure summary

This test suite uses the official JSON-schema test suite, version draft4.

If a validator does not pass a test in the official test suite, it will show up in these results.

failing tests

Validator Number of failing tests (click for details)
@exodus/schemasafe 3
@cfworker/json-schema 9
jsonschema 12
z-schema 21
ajv 26
is-my-json-valid 27
jsen 32
json-schema-library 35
jsck 55
themis 59
tv4 70
skeemas 72
schemasaurus 77
request-validator 81
djv 84
jassi 87
jjv 88
json-schema-validator-generator 92
json-model 120
JSV 145
json-gate 229
revalidator 297

Some validators have deliberately chosen not to support parts of the spec. Go to the homepage of the validator to learn if that is the case for these tests.

Side-effects summary

Number of tests that caused side-effects. The schema or data was altered by the validator.

Validator Number of side-effects (BAD)
tv4 13
revalidator 645
json-model 676

Validators not in the list have no side-effects on data or schemas.

Tests for other JSON-schema versions

Features of validators

Note that these benchmarks and tests do not take into account other more advanced features of the validators. I encourage you to take a look at each validator if you are looking for special features.

Benchmarks by validator authors and others

Several of the validators have build benchmarks themselves. They are more detailed then the benchmarks provided above.

Benchmarks owned by z-schema

Benchmarks owned by jsck

Benchmarks owned by themis

There is also a benchmark suite by cosmicrealms.

License

MIT