Benchmarks for Node.js JSON-schema validators
JavaScript
Switch branches/tags
Nothing to show
Clone or download
Latest commit 051c2f7 Dec 11, 2017

README.md

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% 48052 (± 2.88%)
ajv 98% 47068 (± 0.74%)
json-schema-validator-generator 72.1% 34623 (± 3.8%)
jsen 66.8% 32110 (± 4.38%)
is-my-json-valid 50.1% 24057 (± 4.16%)
themis 15.1% 7244 (± 11.03%)
z-schema 6.1% 2949 (± 2.13%)
jsck 3.8% 1835 (± 1.9%)
skeemas 1.2% 563 (± 1.71%)
json-schema-library 0.7% 338 (± 1.02%)
tv4 0.2% 90 (± 2.63%)

235 tests are run in each test run.

Validators tested: json-schema-validator-generator (1.1.11), is-my-json-valid (2.16.1), jsen (0.6.6), ajv (5.5.1), themis (1.1.6), z-schema (3.19.0), jjv (1.0.2), djv (2.0.0), skeemas (1.2.4), jayschema (0.3.2), schemasaurus (0.7.8), jsck (0.3.2), 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.2.0), revalidator (0.3.1), json-schema-library (3.3.2),

(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)
json-schema-library 1
ajv 1
djv 1
skeemas 6
jsen 9
jsonschema 13
z-schema 13
is-my-json-valid 14
jayschema 20
jjv 26
schemasaurus 29
jsck 29
themis 30
tv4 33
json-schema-validator-generator 34
request-validator 39
jassi 42
json-model 54
JSV 72
json-gate 97
revalidator 152

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 320
json-model 338

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