diff --git a/README.md b/README.md index 0f592e54..0758d748 100644 --- a/README.md +++ b/README.md @@ -81,7 +81,7 @@ You can check the current status on the [Bowtie Report](https://bowtie.report/#/ `jsonschema` outperforms other Rust JSON Schema validators in most scenarios: - Up to **20-470x** faster than `valico` and `jsonschema_valid` for complex schemas -- Generally **2-3x** faster than `boon` +- Generally **3-20x** faster than `boon` For detailed benchmarks, see our [full performance comparison](https://github.com/Stranger6667/jsonschema/tree/master/crates/benchmark-suite). diff --git a/crates/benchmark-suite/README.md b/crates/benchmark-suite/README.md index e695acad..14b1a43b 100644 --- a/crates/benchmark-suite/README.md +++ b/crates/benchmark-suite/README.md @@ -40,23 +40,23 @@ Sources: | Benchmark | jsonschema_valid | valico | boon | jsonschema (validate) | |---------------|------------------|---------------|---------------|------------------------| -| OpenAPI | - | - | 6.60 ms (**x2.97**) | 2.22 ms | -| Swagger | - | 114.26 ms (**x38.93**) | 10.06 ms (**x3.43**) | 2.94 ms | -| GeoJSON | 19.56 ms (**x23.85**) | 299.53 ms (**x365.22**) | 16.59 ms (**x20.23**) | 820.21 µs | -| CITM Catalog | 2.84 ms (**x2.22**) | 28.30 ms (**x22.11**) | 1.11 ms (**x0.87**) | 1.28 ms | -| Fast (Valid) | 1.11 µs (**x4.37**) | 3.78 µs (**x14.89**) | 332.39 ns (**x1.31**) | 253.77 ns | -| Fast (Invalid)| 247.88 ns (**x0.64**) | 3.82 µs (**x9.85**) | 383.79 ns (**x0.99**) | 387.78 ns | +| OpenAPI | - | - | 6.60 ms (**x3.17**) | 2.0813 ms | +| Swagger | - | 114.26 ms (**x51.90**) | 10.06 ms (**x4.57**) | 2.2021 ms | +| GeoJSON | 19.56 ms (**x23.37**) | 299.53 ms (**x358.00**) | 16.59 ms (**x19.82**) | 836.93 µs | +| CITM Catalog | 2.84 ms (**x7.40**) | 28.30 ms (**x73.74**) | 1.11 ms (**x2.89**) | 383.98 µs | +| Fast (Valid) | 1.11 µs (**x14.67**) | 3.78 µs (**x49.94**) | 332.39 ns (**x4.39**) | 75.748 ns | +| Fast (Invalid)| 247.88 ns (**x4.67**) | 3.82 µs (**x71.93**) | 383.79 ns (**x7.22**) | 53.176 ns | ### jsonschema Performance: `validate` vs `is_valid` | Benchmark | validate | is_valid | Speedup | |---------------|------------|------------|---------| -| OpenAPI | 2.2104 ms | 2.0860 ms | **1.06x** | -| Swagger | 2.9327 ms | 1.9649 ms | **1.49x** | -| GeoJSON | 820.21 µs | 803.42 µs | **1.02x** | -| CITM Catalog | 1.2794 ms | 309.66 µs | **4.13x** | -| Fast (Valid) | 253.77 ns | 54.162 ns | **4.69x** | -| Fast (Invalid)| 387.78 ns | 3.4379 ns | **112.80x** | +| OpenAPI | 2.0813 ms | 2.0612 ms | **1.01x** | +| Swagger | 2.2021 ms | 2.0729 ms | **1.06x** | +| GeoJSON | 836.93 µs | 796.28 µs | **1.05x** | +| CITM Catalog | 383.98 µs | 313.13 µs | **1.23x** | +| Fast (Valid) | 75.748 ns | 53.642 ns | **1.41x** | +| Fast (Invalid)| 53.176 ns | 3.4919 ns | **15.23x** | Notes: @@ -64,7 +64,7 @@ Notes: 2. `jsonschema_valid` fails to resolve local references (e.g. `#/definitions/definitions`). -You can find benchmark code in [benches/](benches/), Rust version is `1.81`. +You can find benchmark code in [benches/](benches/), Rust version is `1.82`. ## Contributing diff --git a/crates/jsonschema-py/BENCHMARKS.md b/crates/jsonschema-py/BENCHMARKS.md index 1168d493..70a73776 100644 --- a/crates/jsonschema-py/BENCHMARKS.md +++ b/crates/jsonschema-py/BENCHMARKS.md @@ -45,29 +45,29 @@ Sources: | Benchmark | fastjsonschema | jsonschema | jsonschema-rs | |---------------|----------------|---------------|----------------| -| OpenAPI | - (1) | 644.21 ms (**x83.84**) | 7.68 ms | -| Swagger | - (1) | 1141.58 ms (**x182.70**)| 6.25 ms | -| Canada (GeoJSON) | 10.52 ms (**x4.07**) | 780.44 ms (**x301.87**) | 2.59 ms | -| CITM Catalog | 4.94 ms (**x2.04**) | 82.37 ms (**x34.03**) | 2.42 ms | -| Fast (Valid) | 1.97 µs (**x3.39**) | 37.66 µs (**x64.82**) | 581.00 ns | -| Fast (Invalid)| 2.28 µs (**x2.78**) | 36.45 µs (**x44.40**) | 821.00 ns | +| OpenAPI | - (1) | 682.93 ms (**x95.94**) | 7.12 ms | +| Swagger | - (1) | 1204.99 ms (**x221.35**)| 5.68 ms | +| Canada (GeoJSON) | 11.39 ms (**x4.24**) | 803.60 ms (**x299.57**) | 2.68 ms | +| CITM Catalog | 5.19 ms (**x3.24**) | 85.19 ms (**x53.24**) | 1.65 ms | +| Fast (Valid) | 2.03 µs (**x7.08**) | 37.11 µs (**x129.28**) | 316.60 ns | +| Fast (Invalid)| 2.26 µs (**x3.89**) | 36.31 µs (**x62.37**) | 582.10 ns | ### jsonschema-rs Performance: `validate` vs `is_valid` | Benchmark | validate | is_valid | Speedup | |---------------|------------|------------|---------| -| OpenAPI | 7.68 ms | 6.91 ms | **1.11x** | -| Swagger | 6.25 ms | 5.24 ms | **1.19x** | -| Canada (GeoJSON) | 2.59 ms | 2.59 ms | **1.00x** | -| CITM Catalog | 2.42 ms | 1.36 ms | **1.77x** | -| Fast (Valid) | 581.00 ns | 350.00 ns | **1.66x** | -| Fast (Invalid)| 821.00 ns | 591.00 ns | **1.39x** | +| OpenAPI | 7.12 ms | 7.74 ms | **0.92x** | +| Swagger | 5.68 ms | 5.44 ms | **1.04x** | +| Canada (GeoJSON) | 2.68 ms | 2.68 ms | **1.00x** | +| CITM Catalog | 1.65 ms | 1.60 ms | **1.03x** | +| Fast (Valid) | 316.60 ns | 287.05 ns | **1.10x** | +| Fast (Invalid)| 582.10 ns | 630.99 ns | **0.92x** | Notes: 1. `fastjsonschema` fails to compile the Open API spec due to the presence of the `uri-reference` format (that is not defined in Draft 4). However, unknown formats are explicitly supported by the spec. -You can find benchmark code in [benches/](benches/), Python version `3.13.0`, Rust version `1.81`. +You can find benchmark code in [benches/](benches/), Python version `3.13.0`, Rust version `1.82`. ## Contributing diff --git a/crates/jsonschema-py/README.md b/crates/jsonschema-py/README.md index 0e9c8ac5..03e1d9ef 100644 --- a/crates/jsonschema-py/README.md +++ b/crates/jsonschema-py/README.md @@ -151,15 +151,14 @@ jsonschema_rs.Draft202012Validator(invalid_schema, ignore_unknown_formats=False) `jsonschema-rs` is designed for high performance, outperforming other Python JSON Schema validators in most scenarios: -- Up to **30-390x** faster than `jsonschema` for complex schemas and large instances -- Generally **2-5x** faster than `fastjsonschema` on CPython -- Comparable or slightly slower performance for very small schemas +- Up to **50-390x** faster than `jsonschema` for complex schemas and large instances +- Generally **3-7x** faster than `fastjsonschema` on CPython For detailed benchmarks, see our [full performance comparison](https://github.com/Stranger6667/jsonschema/blob/master/crates/jsonschema-py/BENCHMARKS.md). ## Python support -`jsonschema-rs` supports CPython 3.8, 3.9, 3.10, 3.11, and 3.12. +`jsonschema-rs` supports CPython 3.8, 3.9, 3.10, 3.11, 3.12, and 3.13. ## Acknowledgements