2014 UPDATE

I have updated this post here: Benchmark of node.js JSON Validation Modules Part 3


Old Post

Below are benchmark results for several node.js JSON validation modules.

This is an update to a post I made 2 years ago.

The following modules are benchmarked:

All modules validate with the JSON schema described here: http://json-schema.org/ except for joi which uses a custom schema.

I used the latest schema version supported by each module. This is noted as (v2) (v3) or (v4).

Results



Conclusion

tv4 appears to be the fastest, but it only supports the very latest v4 JSON schema version. So if you have older schema documents, you'll need to go with one of the others.

Jayschema takes the 'slowest validator' crown away from JSV. I'd avoid using it if performance matters to your application.

It should be noted that joi doesn't support the JSON schema specification. Joi uses a custom schema which does not support checking for unique array items or evenly divisible numbers.

Lastly, amanda only supports async validation and so that test includes some additional overhead in dealing with callbacks.

Source Code

Full source code for all the tests can be found here: https://github.com/Sembiance/cosmicrealms.com/tree/master/sandbox/benchmark-of-node-dot-js-json-validation-modules-part-2