Compare various gems doing json schema validation.
At the moment we are only looking at gems implementing Draft 7 of json schema.
Update by running:
bundle exec ruby spec/benchmark.rb
Run against:
- #37~20.04.2-Ubuntu @ kernel: 5.8.0-34-generic
- AMD Ryzen 9 3900X 12-Core
- 32GB RAM
Simple boolean result.
Results in instructions/validations per second.
Gem | Tiny Schema | Schema | Big Schema | ||
---|---|---|---|---|---|
Valid | Invalid | Valid | Invalid | Valid | |
RustyJSONSchema | 362966.1 | 423275.2 | 285533.3 | 303590.7 | 12.8 |
JSONSchemer | 98019.9 - 3.70x | 258478.2 - 1.64x | 14239.3 - 20.05x | 166074.7 - 1.83x | 0.5 - 25.42x |
Returns a list of validation errors if any
Results in instructions/validations per second.
Gem | Tiny Schema | Schema | Big Schema | ||
---|---|---|---|---|---|
Valid | Invalid | Valid | Invalid | Valid | |
RustyJSONSchema | 180723.6 | 148233.0 | 151118.6 | 121512.6 | 13.0 |
JSONSchemer | 98568.1 - 1.83x | 99045.2 - 1.50x | 14385.3 - 10.51x | 12263.2 - 9.91x | 0.5 - 26.02x |