diff --git a/README.md b/README.md index 7637c5a..2745f74 100644 --- a/README.md +++ b/README.md @@ -20,6 +20,11 @@ This repo tests the following implementations of JSON schema validation: | [worldturner/medeia-validator][7] | Kotlin | draft-07, -06, -04 | Apache License 2.0 | | [erosb/json-sKema][8] | Kotlin | 2020-12 | MIT | +## Note to maintainers + +If you are the maintainer of one of the above implementations, please feel free to raise a PR if you feel your +implementation is poorly represented due to issues with the code in this repo. + ## Feature comparison To run the comparison: `./gradlew runFunctionalTests` @@ -140,7 +145,7 @@ whereas _optional_ features only account for a maximum 25% of the score. ### Feature comparison conclusions -`ScheamFriend` comes out as the clear winner of the functional test, with support for all Schema specification, at the time of writing, _and_ the highest overall score. +At the time of writing, `ScheamFriend` comes out as the clear winner of the functional test, with support for all Schema specification, at the time of writing, _and_ the highest overall score. Ignoring which implementations support which drafts for a moment, a rough ranking on functionality would be: @@ -229,6 +234,24 @@ JsonValidateBenchmark.measureDraft_7_Vertx avgt 20 2.141 ± ``` Note: results from running on 2021 Macbook Pro, M1 Max: 2.06 - 3.22 GHz, in High Power mode, JDK 17.0.6 +Each of the following graphs compares the average time it took each implementation to validate all of its **positive** +test cases. + +The following caveats apply to the results: +1. The `Snow` implementation has been removed from the graphs, as its so slow that it makes the graph unreadable when trying to compare the other implementations. +2. Comparison of time between the different drafts, i.e. between the different charts, is fairly meaningless, as the number of tests changes. Latter drafts generally have move test cases, meaning they take longer to run. +3. When comparing times a graph, remember that the time only covers each implementation's positive test cases. This means implementations with less functional coverage have less positive cases to handle. + +![JsonValidateBenchmark-Draft-4.svg](img/JsonValidateBenchmark-Draft-4.svg) + +![JsonValidateBenchmark-Draft-6.svg](img/JsonValidateBenchmark-Draft-6.svg) + +![JsonValidateBenchmark-Draft-7.svg](img/JsonValidateBenchmark-Draft-7.svg) + +![JsonValidateBenchmark-Draft-2019-0.svg](img/JsonValidateBenchmark-Draft-2019-0.svg) + +![JsonValidateBenchmark-Draft-2020-12.svg](img/JsonValidateBenchmark-Draft-2020-12.svg) + ### Schema validated JSON (de)serialization benchmark The `JsonSerdeBenchmark` benchmark measures the average time taken to serialize a simple Java object, including polymorphism, to JSON and back, @@ -254,17 +277,27 @@ JsonSerdeBenchmark.measureVertxRoundTrip avgt 20 514.517 ± ``` Note: results from running on 2021 Macbook Pro, M1 Max: 2.06 - 3.22 GHz, in High Power mode, JDK 17.0.6 +![JsonSerdeBenchmark Results.svg](img%2FJsonSerdeBenchmark%20Results.svg) + ### Performance comparison conclusions -Coming soon... +At the time of writing, `Medeia` comes as a clear winner for speed, with `Everit` not far behind. +However, these implementations look to no longer be maintained, or are deprecated, respectively. +Plus, neither of them handle the latest drafts of the JSON schema standard. +If `Medeia` and `Everit` are excluded, then the clear winner is `SchemaFriend`. -## Overall comparison +## Conclusions -Coming soon... +Hopefully this comparison is useful. The intended use-case will likely dictate which implementation(s) are suitable. -## Conclusions +If your use-case requires ultimate speed, doesn't require advanced features or support for the later draft specifications, +and you're happy with the maintenance risk associated with them, then either `Medeia` or `Everit` may be the implementation for you. +It's worth pointing out that [Confluent][confluent]'s own JSON serde internally use `Everit`, which may mean they'll be helping to support it going forward. + +Alternatively, if you're either uneasy using deprecated or unmaintained libraries, or need more functionality or support for the latest drafts, +then these tests would suggest you take a look at `SchemaFriend`: it comes out to for functionality and is only beaten on performance by the unmaintained or deprecated `Medeia` and `Everit`. -Coming soon... +Note: The author of this repository is not affiliated with any of the implementations covered by this test suite. [1]: https://github.com/eclipse-vertx/vertx-json-schema [2]: https://github.com/jimblackler/jsonschemafriend @@ -275,4 +308,5 @@ Coming soon... [7]: https://github.com/worldturner/medeia-validator [8]: https://github.com/erosb/json-sKema [JSON-Schema-Test-Suite]: https://github.com/json-schema-org/JSON-Schema-Test-Suite -[jhm]: https://github.com/openjdk/jmh \ No newline at end of file +[jhm]: https://github.com/openjdk/jmh +[confluent]: https://www.confluent.io/ \ No newline at end of file diff --git a/build.gradle.kts b/build.gradle.kts index 2b7e825..c53053d 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -152,14 +152,17 @@ val benchmarkSmokeTest = tasks.register("runBenchmarkSmokeTest") { dependsOn(pullTask) } -tasks.register("coveralls") { - // dummy -} - tasks.test { dependsOn(runFunctionalTests, benchmarkSmokeTest) } +// Dummy / empty tasks required to allow the repo to use the same standard GitHub workflows as other Creek repos: +tasks.register("coveralls") +tasks.register("cV") +tasks.register("publish") +tasks.register("closeAndReleaseStagingRepository") +tasks.register("publishPlugins") + // Below is required until the following is fixed in IntelliJ: // https://youtrack.jetbrains.com/issue/IDEA-316081/Gradle-8-toolchain-error-Toolchain-from-executable-property-does-not-match-toolchain-from-javaLauncher-property-when-different gradle.taskGraph.whenReady { diff --git a/img/Feature comparison score.svg b/img/Feature comparison score.svg index 3034d46..40dc889 100644 --- a/img/Feature comparison score.svg +++ b/img/Feature comparison score.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/img/JsonSerdeBenchmark Results.svg b/img/JsonSerdeBenchmark Results.svg new file mode 100644 index 0000000..c26ec35 --- /dev/null +++ b/img/JsonSerdeBenchmark Results.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/img/JsonValidateBenchmark-Draft-2019-0.svg b/img/JsonValidateBenchmark-Draft-2019-0.svg new file mode 100644 index 0000000..45c2cb3 --- /dev/null +++ b/img/JsonValidateBenchmark-Draft-2019-0.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/img/JsonValidateBenchmark-Draft-2020-12.svg b/img/JsonValidateBenchmark-Draft-2020-12.svg new file mode 100644 index 0000000..cc1b978 --- /dev/null +++ b/img/JsonValidateBenchmark-Draft-2020-12.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/img/JsonValidateBenchmark-Draft-4.svg b/img/JsonValidateBenchmark-Draft-4.svg new file mode 100644 index 0000000..ffcb753 --- /dev/null +++ b/img/JsonValidateBenchmark-Draft-4.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/img/JsonValidateBenchmark-Draft-6.svg b/img/JsonValidateBenchmark-Draft-6.svg new file mode 100644 index 0000000..79989ee --- /dev/null +++ b/img/JsonValidateBenchmark-Draft-6.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/img/JsonValidateBenchmark-Draft-7.svg b/img/JsonValidateBenchmark-Draft-7.svg new file mode 100644 index 0000000..935eba7 --- /dev/null +++ b/img/JsonValidateBenchmark-Draft-7.svg @@ -0,0 +1 @@ + \ No newline at end of file