natesilva / jayschema

[Unmaintained] - A comprehensive JSON Schema validator for Node.js
BSD 3-Clause "New" or "Revised" License
217 stars 22 forks source link

Speed: the validator is-my-json-valid is thousands of times faster then jayschema #47

Open ebdrup opened 9 years ago

ebdrup commented 9 years ago

I've been investigating JSON-schema validators. And contributing to the benchmarks at the JSON-schema validators themisand JSCK. According to the benchmarks included in both themis and JSCK. Jayschema is extreemely slow. And is-my-json-valid is the fastest of all at least 5 times faster than the runner up, and thousands of times faster than jayschema.

redben commented 9 years ago

Wow that's a big difference...

For reference: http://cosmicrealms.com/blog/2014/08/29/benchmark-of-node-dot-js-json-validation-modules-part-3/

natesilva commented 9 years ago

JaySchema was created at a time when there were very few comprehensive options for JSON Schema. Most validators supported an older version, or only a subset of the current version. Its goal was to be complete and accurate (pass all unit tests).

Although the goal was never to be fastest, it was fast enough for many things, including our internal use cases.

Now the situation has improved and there are other comprehensive validators, which are also much faster. If starting over, there wouldn’t be a need to create JaySchema.

For my use cases it’s still fine—as they say, it continues to work as well today as it did yesterday. But speeding it up would require a significant re-architecture.

I would be glad to link to some of the other validators from the JaySchema README, if someone wants to make recommendations.

ebdrup commented 9 years ago

I created a benchmark, and a list of what official test are failing for each validator here: https://github.com/Muscula/json-schema-benchmark