Skip to content

Latest commit

 

History

History
103 lines (73 loc) · 9 KB

README.md

File metadata and controls

103 lines (73 loc) · 9 KB

json-schema-benchmark (draft6)

Performance benchmark for Node.js JSON-schema validators.

Also tests against official JSON-schema test suite, version draft6. 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% 17000 (± 0.34%)
@exodus/schemasafe 69.2% 11760 (± 0.89%)
is-my-json-valid 51.5% 8757 (± 0.37%)
djv 13.1% 2223 (± 1.24%)
@cfworker/json-schema 5.1% 865 (± 1.15%)
jsonschema 1.2% 198 (± 1.11%)

884 tests are run in each test run.

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

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 8
@cfworker/json-schema 9
ajv 10
jsonschema 33
djv 99
is-my-json-valid 111
json-schema-library 140
jsen 141
tv4 155
z-schema 169
jjv 171
jassi 172
themis 189
request-validator 207
json-schema-validator-generator 216
json-model 225
jsck 227
JSV 234
skeemas 235
schemasaurus 237
json-gate 342
revalidator 384

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)
revalidator 818
json-model 833

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 themis

Benchmarks owned by jsck

There is also a benchmark suite by cosmicrealms.

License

MIT