Skip to content

chlee-dev/json-schema-benchmark

 
 

Repository files navigation

json-schema-benchmark

Performance benchmark for Node.js JSON-schema validators.

Also tests against official JSON-schema test suite and checks for validators that cause side-effects on schema or data.

Contribute to these benchmarks

Performance

performance

Validator Relative speed Number of test runs per second
djv 100% 30718 (± 2.83%)
ajv 87.8% 26971 (± 3.37%)
jsen 59.2% 18174 (± 7.39%)
is-my-json-valid 54.7% 16809 (± 0.74%)
schemasaurus 15% 4594 (± 2.07%)
themis 13.8% 4241 (± 6.04%)
z-schema 5.3% 1643 (± 0.62%)
jsck 4.8% 1469 (± 2.63%)
jsonschema 0.8% 244 (± 3.46%)
tv4 0.4% 113 (± 2.06%)

235 tests are run in each test run.

Validators tested: json-schema-validator-generator, is-my-json-valid (2.16.0), jsen (0.6.4), ajv (5.1.5), themis (1.1.6), z-schema (3.18.2), jjv (1.0.2), djv (1.0.0-beta.0), skeemas (1.2.2), jayschema (0.3.1), schemasaurus (0.7.8), jsck (0.3.1), jassi (0.1.2), JSV (4.0.2), request-validator (0.3.3), json-gate (0.8.23), json-model (0.2.24), tv4 (1.3.0), jsonschema (1.1.1), revalidator (0.3.1),

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

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

The fastest validator has 100%, the rest a lower score relative to the fastest. If a validator has a score of 5% that means that it's speed is 5% of the fastest, meaning that it's 20 times slower than the fastest.

Test failure summary

This test suite uses the official JSON-schema test suite.

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)
ajv 1
jsen 5
z-schema 8
jsonschema 10
is-my-json-valid 14
skeemas 14
jjv 17
djv 18
jayschema 19
themis 24
schemasaurus 27
jsck 29
tv4 30
request-validator 36
jassi 39
json-model 51
JSV 67
json-gate 80
revalidator 148
json-schema-validator-generator 159

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 11
revalidator 294
json-model 310

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

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 themis

Benchmarks owned by z-schema

Benchmarks owned by jsck

There is also a benchmark suite by cosmicrealms.

License

MIT

About

Benchmarks for Node.js JSON-schema validators

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%