From 41214b0efd7c408a97c3d8952b0217d118bb4b84 Mon Sep 17 00:00:00 2001 From: Andriy Plokhotnyuk Date: Thu, 26 Dec 2024 18:45:12 +0100 Subject: [PATCH] Add benchmarks for zio-schema-json --- build.sbt | 1 + .../jsoniter_scala/benchmark/Main.scala | 60 +++++++++---- .../jsoniter_scala/benchmark/Main.scala | 60 +++++++++---- .../benchmark/ADTReadingSpec.scala | 4 + .../benchmark/ADTWritingSpec.scala | 3 +- .../benchmark/AnyValsReadingSpec.scala | 3 +- .../benchmark/AnyValsWritingSpec.scala | 1 + .../benchmark/ExtractFieldsReadingSpec.scala | 2 + .../benchmark/GeoJSONReadingSpec.scala | 4 + .../benchmark/GeoJSONWritingSpec.scala | 1 + .../GitHubActionsAPIReadingSpec.scala | 2 + .../GitHubActionsAPIWritingSpec.scala | 1 + .../GoogleMapsAPIPrettyPrintingSpec.scala | 1 + .../benchmark/GoogleMapsAPIReadingSpec.scala | 2 + .../benchmark/GoogleMapsAPIWritingSpec.scala | 1 + .../MissingRequiredFieldsReadingSpec.scala | 2 + .../benchmark/NestedStructsReadingSpec.scala | 5 +- .../benchmark/NestedStructsWritingSpec.scala | 1 + .../benchmark/OpenRTBReadingSpec.scala | 2 + .../benchmark/OpenRTBWritingSpec.scala | 4 +- .../benchmark/PrimitivesReadingSpec.scala | 2 + .../benchmark/PrimitivesWritingSpec.scala | 1 + .../benchmark/TwitterAPIReadingSpec.scala | 2 + .../benchmark/TwitterAPIWritingSpec.scala | 5 +- .../benchmark/ADTReadingSpec.scala | 4 + .../benchmark/ADTWritingSpec.scala | 2 + .../benchmark/AnyValsReadingSpec.scala | 2 + .../benchmark/ExtractFieldsReadingSpec.scala | 2 + .../benchmark/GeoJSONReadingSpec.scala | 4 + .../benchmark/GeoJSONWritingSpec.scala | 1 + .../GitHubActionsAPIReadingSpec.scala | 2 + .../GitHubActionsAPIWritingSpec.scala | 1 + .../GoogleMapsAPIPrettyPrintingSpec.scala | 1 + .../benchmark/GoogleMapsAPIReadingSpec.scala | 2 + .../benchmark/GoogleMapsAPIWritingSpec.scala | 1 + .../MissingRequiredFieldsReadingSpec.scala | 2 + .../benchmark/NestedStructsReadingSpec.scala | 4 + .../benchmark/NestedStructsWritingSpec.scala | 1 + .../benchmark/OpenRTBReadingSpec.scala | 2 + .../benchmark/OpenRTBWritingSpec.scala | 4 +- .../benchmark/PrimitivesReadingSpec.scala | 2 + .../benchmark/PrimitivesWritingSpec.scala | 1 + .../benchmark/TwitterAPIReadingSpec.scala | 2 + .../benchmark/TwitterAPIWritingSpec.scala | 5 +- .../benchmark/ADTReadingSpec.scala | 4 + .../benchmark/ADTWritingSpec.scala | 2 + .../benchmark/AnyValsReadingSpec.scala | 2 + .../benchmark/AnyValsWritingSpec.scala | 1 + .../benchmark/ExtractFieldsReadingSpec.scala | 2 + .../benchmark/GeoJSONReadingSpec.scala | 4 + .../benchmark/GeoJSONWritingSpec.scala | 1 + .../GitHubActionsAPIReadingSpec.scala | 2 + .../GitHubActionsAPIWritingSpec.scala | 1 + .../GoogleMapsAPIPrettyPrintingSpec.scala | 1 + .../benchmark/GoogleMapsAPIReadingSpec.scala | 2 + .../benchmark/GoogleMapsAPIWritingSpec.scala | 1 + .../MissingRequiredFieldsReadingSpec.scala | 2 + .../benchmark/NestedStructsReadingSpec.scala | 4 + .../benchmark/NestedStructsWritingSpec.scala | 1 + .../benchmark/OpenRTBReadingSpec.scala | 2 + .../benchmark/OpenRTBWritingSpec.scala | 4 +- .../benchmark/PrimitivesReadingSpec.scala | 2 + .../benchmark/PrimitivesWritingSpec.scala | 1 + .../benchmark/TwitterAPIReadingSpec.scala | 2 + .../benchmark/TwitterAPIWritingSpec.scala | 3 +- .../benchmark/ADTReadingSpec.scala | 4 + .../benchmark/ADTWritingSpec.scala | 2 + .../benchmark/AnyValsReadingSpec.scala | 2 + .../benchmark/AnyValsWritingSpec.scala | 1 + .../benchmark/ExtractFieldsReadingSpec.scala | 2 + .../benchmark/GeoJSONReadingSpec.scala | 4 + .../benchmark/GeoJSONWritingSpec.scala | 1 + .../GitHubActionsAPIReadingSpec.scala | 2 + .../GitHubActionsAPIWritingSpec.scala | 1 + .../GoogleMapsAPIPrettyPrintingSpec.scala | 1 + .../benchmark/GoogleMapsAPIReadingSpec.scala | 2 + .../benchmark/GoogleMapsAPIWritingSpec.scala | 1 + .../MissingRequiredFieldsReadingSpec.scala | 2 + .../benchmark/NestedStructsReadingSpec.scala | 4 + .../benchmark/NestedStructsWritingSpec.scala | 1 + .../benchmark/OpenRTBReadingSpec.scala | 2 + .../benchmark/OpenRTBWritingSpec.scala | 4 +- .../benchmark/PrimitivesReadingSpec.scala | 3 +- .../benchmark/PrimitivesWritingSpec.scala | 1 + .../benchmark/TwitterAPIReadingSpec.scala | 3 +- .../benchmark/TwitterAPIWritingSpec.scala | 3 +- .../jsoniter_scala/benchmark/ADTReading.scala | 14 ++- .../jsoniter_scala/benchmark/ADTWriting.scala | 13 ++- .../benchmark/AnyValsReading.scala | 13 ++- .../benchmark/AnyValsWriting.scala | 13 ++- .../ArrayBufferOfBooleansWriting.scala | 2 +- .../benchmark/ArrayOfBigDecimalsReading.scala | 2 +- .../benchmark/ArrayOfBigDecimalsWriting.scala | 2 +- .../benchmark/ArrayOfBigIntsReading.scala | 2 +- .../benchmark/ArrayOfBigIntsWriting.scala | 2 +- .../benchmark/ArrayOfBooleansWriting.scala | 2 +- .../benchmark/ArrayOfBytesWriting.scala | 2 +- .../benchmark/ArrayOfCharsWriting.scala | 2 +- .../benchmark/ArrayOfDoublesWriting.scala | 2 +- .../benchmark/ArrayOfDurationsWriting.scala | 2 +- .../benchmark/ArrayOfEnumADTsReading.scala | 4 +- .../benchmark/ArrayOfEnumADTsWriting.scala | 4 +- .../benchmark/ArrayOfEnumsReading.scala | 4 +- .../benchmark/ArrayOfEnumsWriting.scala | 4 +- .../benchmark/ArrayOfFloatsWriting.scala | 2 +- .../benchmark/ArrayOfInstantsWriting.scala | 2 +- .../benchmark/ArrayOfIntsReading.scala | 2 +- .../benchmark/ArrayOfIntsWriting.scala | 2 +- .../ArrayOfLocalDateTimesWriting.scala | 2 +- .../benchmark/ArrayOfLocalDatesWriting.scala | 2 +- .../benchmark/ArrayOfLocalTimesWriting.scala | 2 +- .../benchmark/ArrayOfLongsWriting.scala | 2 +- .../benchmark/ArrayOfMonthDaysWriting.scala | 2 +- .../ArrayOfOffsetDateTimesWriting.scala | 2 +- .../benchmark/ArrayOfOffsetTimesWriting.scala | 2 +- .../benchmark/ArrayOfPeriodsWriting.scala | 2 +- .../benchmark/ArrayOfShortsReading.scala | 2 +- .../benchmark/ArrayOfShortsWriting.scala | 2 +- .../benchmark/ArrayOfUUIDsWriting.scala | 2 +- .../benchmark/ArrayOfYearMonthsWriting.scala | 2 +- .../benchmark/ArrayOfYearsWriting.scala | 2 +- .../benchmark/ArrayOfZoneIdsWriting.scala | 2 +- .../benchmark/ArrayOfZoneOffsetsWriting.scala | 2 +- .../ArrayOfZonedDateTimesWriting.scala | 2 +- .../benchmark/ArraySeqOfBooleansReading.scala | 2 +- .../benchmark/ArraySeqOfBooleansWriting.scala | 2 +- .../benchmark/Base64Reading.scala | 4 +- .../benchmark/Base64Writing.scala | 4 +- .../benchmark/BigDecimalWriting.scala | 2 +- .../benchmark/BigIntWriting.scala | 2 +- .../benchmark/ExtractFieldsReading.scala | 13 ++- .../benchmark/GeoJSONReading.scala | 14 ++- .../benchmark/GeoJSONWriting.scala | 13 ++- .../benchmark/GitHubActionsAPIReading.scala | 13 ++- .../benchmark/GitHubActionsAPIWriting.scala | 13 ++- .../GoogleMapsAPIPrettyPrinting.scala | 10 ++- .../benchmark/GoogleMapsAPIReading.scala | 13 ++- .../benchmark/GoogleMapsAPIWriting.scala | 13 ++- .../jsoniter_scala/benchmark/IntWriting.scala | 2 +- .../benchmark/ListOfBooleansWriting.scala | 2 +- .../MapOfIntsToBooleansReading.scala | 2 +- .../MapOfIntsToBooleansWriting.scala | 2 +- .../MissingRequiredFieldsReading.scala | 13 ++- .../MutableMapOfIntsToBooleansWriting.scala | 2 +- .../benchmark/MutableSetOfIntsWriting.scala | 2 +- .../benchmark/NestedStructsReading.scala | 16 +++- .../benchmark/NestedStructsWriting.scala | 13 ++- .../benchmark/OpenRTBReading.scala | 12 ++- .../benchmark/OpenRTBWriting.scala | 16 +++- .../benchmark/PrimitivesReading.scala | 13 ++- .../benchmark/PrimitivesWriting.scala | 13 ++- .../benchmark/SetOfIntsWriting.scala | 2 +- .../benchmark/StringOfAsciiCharsWriting.scala | 2 +- .../StringOfNonAsciiCharsWriting.scala | 2 +- .../benchmark/TwitterAPIReading.scala | 13 ++- .../benchmark/TwitterAPIWriting.scala | 14 ++- .../benchmark/VectorOfBooleansWriting.scala | 2 +- .../jsoniter_scala/benchmark/ADTReading.scala | 14 ++- .../jsoniter_scala/benchmark/ADTWriting.scala | 14 ++- .../benchmark/AnyValsReading.scala | 13 ++- .../benchmark/AnyValsWriting.scala | 13 ++- .../ArrayBufferOfBooleansWriting.scala | 2 +- .../benchmark/ArrayOfBigDecimalsReading.scala | 2 +- .../benchmark/ArrayOfBigDecimalsWriting.scala | 2 +- .../benchmark/ArrayOfBigIntsReading.scala | 2 +- .../benchmark/ArrayOfBigIntsWriting.scala | 2 +- .../benchmark/ArrayOfBooleansWriting.scala | 2 +- .../benchmark/ArrayOfBytesWriting.scala | 2 +- .../benchmark/ArrayOfCharsWriting.scala | 2 +- .../benchmark/ArrayOfDoublesWriting.scala | 2 +- .../benchmark/ArrayOfDurationsWriting.scala | 2 +- .../benchmark/ArrayOfEnumADTsReading.scala | 5 +- .../benchmark/ArrayOfEnumADTsWriting.scala | 5 +- .../benchmark/ArrayOfEnumsReading.scala | 5 +- .../benchmark/ArrayOfEnumsWriting.scala | 5 +- .../benchmark/ArrayOfFloatsWriting.scala | 2 +- .../benchmark/ArrayOfInstantsWriting.scala | 2 +- .../benchmark/ArrayOfIntsReading.scala | 2 +- .../benchmark/ArrayOfIntsWriting.scala | 2 +- .../ArrayOfLocalDateTimesWriting.scala | 2 +- .../benchmark/ArrayOfLocalDatesWriting.scala | 2 +- .../benchmark/ArrayOfLocalTimesWriting.scala | 2 +- .../benchmark/ArrayOfLongsWriting.scala | 2 +- .../benchmark/ArrayOfMonthDaysWriting.scala | 2 +- .../ArrayOfOffsetDateTimesWriting.scala | 2 +- .../benchmark/ArrayOfOffsetTimesWriting.scala | 2 +- .../benchmark/ArrayOfPeriodsWriting.scala | 2 +- .../benchmark/ArrayOfShortsReading.scala | 2 +- .../benchmark/ArrayOfShortsWriting.scala | 2 +- .../benchmark/ArrayOfUUIDsWriting.scala | 2 +- .../benchmark/ArrayOfYearMonthsWriting.scala | 2 +- .../benchmark/ArrayOfYearsWriting.scala | 2 +- .../benchmark/ArrayOfZoneIdsWriting.scala | 2 +- .../benchmark/ArrayOfZoneOffsetsWriting.scala | 2 +- .../ArrayOfZonedDateTimesWriting.scala | 2 +- .../benchmark/ArraySeqOfBooleansReading.scala | 2 +- .../benchmark/ArraySeqOfBooleansWriting.scala | 2 +- .../benchmark/Base64Reading.scala | 4 +- .../benchmark/Base64Writing.scala | 4 +- .../benchmark/BigDecimalWriting.scala | 2 +- .../benchmark/BigIntWriting.scala | 2 +- .../benchmark/ExtractFieldsReading.scala | 13 ++- .../benchmark/GeoJSONReading.scala | 14 ++- .../benchmark/GeoJSONWriting.scala | 13 ++- .../benchmark/GitHubActionsAPIReading.scala | 13 ++- .../benchmark/GitHubActionsAPIWriting.scala | 13 ++- .../GoogleMapsAPIPrettyPrinting.scala | 10 ++- .../benchmark/GoogleMapsAPIReading.scala | 13 ++- .../benchmark/GoogleMapsAPIWriting.scala | 13 ++- .../jsoniter_scala/benchmark/IntWriting.scala | 2 +- .../benchmark/ListOfBooleansWriting.scala | 2 +- .../MapOfIntsToBooleansReading.scala | 2 +- .../MapOfIntsToBooleansWriting.scala | 2 +- .../MissingRequiredFieldsReading.scala | 13 ++- .../MutableMapOfIntsToBooleansWriting.scala | 2 +- .../benchmark/MutableSetOfIntsWriting.scala | 2 +- .../benchmark/NestedStructsReading.scala | 14 ++- .../benchmark/NestedStructsWriting.scala | 13 ++- .../benchmark/OpenRTBReading.scala | 12 ++- .../benchmark/OpenRTBWriting.scala | 16 +++- .../benchmark/PrimitivesReading.scala | 13 ++- .../benchmark/PrimitivesWriting.scala | 13 ++- .../benchmark/SetOfIntsWriting.scala | 2 +- .../benchmark/StringOfAsciiCharsWriting.scala | 2 +- .../StringOfNonAsciiCharsWriting.scala | 2 +- .../benchmark/TwitterAPIReading.scala | 13 ++- .../benchmark/TwitterAPIWriting.scala | 14 ++- .../benchmark/VectorOfBooleansWriting.scala | 2 +- ...oderDecoders.scala => ZioJsonCodecs.scala} | 2 +- .../benchmark/ZioSchemaJsonCodecs.scala | 90 +++++++++++++++++++ 230 files changed, 892 insertions(+), 288 deletions(-) rename jsoniter-scala-benchmark/shared/src/main/scala/com/github/plokhotnyuk/jsoniter_scala/benchmark/{ZioJSONEncoderDecoders.scala => ZioJsonCodecs.scala} (99%) create mode 100644 jsoniter-scala-benchmark/shared/src/main/scala/com/github/plokhotnyuk/jsoniter_scala/benchmark/ZioSchemaJsonCodecs.scala diff --git a/build.sbt b/build.sbt index d8e893d09..ed22fd8f9 100644 --- a/build.sbt +++ b/build.sbt @@ -244,6 +244,7 @@ lazy val `jsoniter-scala-benchmark` = crossProject(JVMPlatform, JSPlatform) "com.evolutiongaming" %%% "play-json-jsoniter" % "0.10.3" intransitive(), "org.playframework" %%% "play-json" % "3.0.4", "dev.zio" %%% "zio-json" % "0.7.3", + "dev.zio" %%% "zio-schema-json" % "1.5.0", "io.circe" %%% "circe-generic" % "0.14.10", "io.circe" %%% "circe-jawn" % "0.14.10", "com.lihaoyi" %%% "upickle" % "4.0.2", diff --git a/jsoniter-scala-benchmark/js/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/Main.scala b/jsoniter-scala-benchmark/js/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/Main.scala index 5cc4eadf1..156ad1a49 100644 --- a/jsoniter-scala-benchmark/js/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/Main.scala +++ b/jsoniter-scala-benchmark/js/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/Main.scala @@ -26,6 +26,8 @@ object Main { B("smithy4sJson")(benchmark.smithy4sJson()), B("uPickle")(benchmark.uPickle()), B("zioJson")(benchmark.zioJson()) + //FIXME: zio-schema-json throws java.lang.RuntimeException: .type.Z.l.type(unrecognized subtype) + //B("zioSchemaJson")(benchmark.zioSchemaJson()) )) }, { val benchmark = new ADTWriting { setup() } @@ -41,6 +43,8 @@ object Main { B("smithy4sJson")(benchmark.smithy4sJson()), B("uPickle")(benchmark.uPickle()), B("zioJson")(benchmark.zioJson()) + //FIXME: zio-schema-json doesn't serialize the discriminator field + //B("zioSchemaJson")(benchmark.zioSchemaJson()) )) }, { val benchmark = new AnyValsReading { setup() } @@ -54,7 +58,8 @@ object Main { B("playJsonJsoniter")(benchmark.playJsonJsoniter()), B("smithy4sJson")(benchmark.smithy4sJson()), B("uPickle")(benchmark.uPickle()), - B("zioJson")(benchmark.zioJson()) + B("zioJson")(benchmark.zioJson()), + B("zioSchemaJson")(benchmark.zioSchemaJson()) )) }, { val benchmark = new AnyValsWriting { setup() } @@ -69,7 +74,8 @@ object Main { B("playJsonJsoniter")(benchmark.playJsonJsoniter()), B("smithy4sJson")(benchmark.smithy4sJson()), B("uPickle")(benchmark.uPickle()), - B("zioJson")(benchmark.zioJson()) + B("zioJson")(benchmark.zioJson()), + B("zioSchemaJson")(benchmark.zioSchemaJson()) )) }, { val benchmark = new ArrayBufferOfBooleansReading { size = 128; setup() } @@ -1031,7 +1037,8 @@ object Main { B("playJsonJsoniter")(benchmark.playJsonJsoniter()), B("smithy4sJson")(benchmark.smithy4sJson()), B("uPickle")(benchmark.uPickle()), - B("zioJson")(benchmark.zioJson()) + B("zioJson")(benchmark.zioJson()), + B("zioSchemaJson")(benchmark.zioSchemaJson()) )) }, { val benchmark = new GeoJSONReading { setup() } @@ -1046,6 +1053,8 @@ object Main { B("smithy4sJson")(benchmark.smithy4sJson()), B("uPickle")(benchmark.uPickle()), B("zioJson")(benchmark.zioJson()) + //FIXME: zio-schema-json throws java.lang.RuntimeException: .type.FeatureCollection.features[0].type.Feature.geometry.type.Polygon(unrecognized subtype) + //B("zioSchemaJson")(benchmark.zioSchemaJson()) )) }, { val benchmark = new GeoJSONWriting { setup() } @@ -1060,7 +1069,8 @@ object Main { B("playJsonJsoniter")(benchmark.playJsonJsoniter()), B("smithy4sJson")(benchmark.smithy4sJson()), B("uPickle")(benchmark.uPickle()), - B("zioJson")(benchmark.zioJson()) + B("zioJson")(benchmark.zioJson()), + B("zioSchemaJson")(benchmark.zioSchemaJson()) )) }, { val benchmark = new GitHubActionsAPIReading { setup() } @@ -1074,7 +1084,8 @@ object Main { B("playJsonJsoniter")(benchmark.playJsonJsoniter()), B("smithy4sJson")(benchmark.smithy4sJson()), B("uPickle")(benchmark.uPickle()), - B("zioJson")(benchmark.zioJson()) + B("zioJson")(benchmark.zioJson()), + B("zioSchemaJson")(benchmark.zioSchemaJson()) )) }, { val benchmark = new GitHubActionsAPIWriting { setup() } @@ -1089,7 +1100,8 @@ object Main { B("playJsonJsoniter")(benchmark.playJsonJsoniter()), B("smithy4sJson")(benchmark.smithy4sJson()), B("uPickle")(benchmark.uPickle()), - B("zioJson")(benchmark.zioJson()) + B("zioJson")(benchmark.zioJson()), + B("zioSchemaJson")(benchmark.zioSchemaJson()) )) }, { val benchmark = new GoogleMapsAPIPrettyPrinting { setup() } @@ -1104,7 +1116,8 @@ object Main { B("playJsonJsoniter")(benchmark.playJsonJsoniter()), B("smithy4sJson")(benchmark.smithy4sJson()), B("uPickle")(benchmark.uPickle()), - B("zioJson")(benchmark.zioJson()) + B("zioJson")(benchmark.zioJson()), + B("zioSchemaJson")(benchmark.zioSchemaJson()) )) }, { val benchmark = new GoogleMapsAPIReading { setup() } @@ -1118,7 +1131,8 @@ object Main { B("playJsonJsoniter")(benchmark.playJsonJsoniter()), B("smithy4sJson")(benchmark.smithy4sJson()), B("uPickle")(benchmark.uPickle()), - B("zioJson")(benchmark.zioJson()) + B("zioJson")(benchmark.zioJson()), + B("zioSchemaJson")(benchmark.zioSchemaJson()) )) }, { val benchmark = new GoogleMapsAPIWriting { setup() } @@ -1133,7 +1147,8 @@ object Main { B("playJsonJsoniter")(benchmark.playJsonJsoniter()), B("smithy4sJson")(benchmark.smithy4sJson()), B("uPickle")(benchmark.uPickle()), - B("zioJson")(benchmark.zioJson()) + B("zioJson")(benchmark.zioJson()), + B("zioSchemaJson")(benchmark.zioSchemaJson()) )) }, { val benchmark = new IntMapOfBooleansReading { size = 128; setup() } @@ -1249,7 +1264,8 @@ object Main { B("playJsonJsoniter")(benchmark.playJsonJsoniter()), B("smithy4sJson")(benchmark.smithy4sJson()), B("uPickle")(benchmark.uPickle()), - B("zioJson")(benchmark.zioJson()) + B("zioJson")(benchmark.zioJson()), + B("zioSchemaJson")(benchmark.zioSchemaJson()) )) }, { val benchmark = new MutableBitSetReading { size = 128; setup() } @@ -1349,6 +1365,8 @@ object Main { B("smithy4sJson")(benchmark.smithy4sJson()), B("uPickle")(benchmark.uPickle()), B("zioJson")(benchmark.zioJson()) + //FIXME: zio-schema-json parses only 127 levels of nesting instead of 128 + //B("zioSchemaJson")(benchmark.zioSchemaJson()) )) }, { val benchmark = new NestedStructsWriting { size = 128; setup() } @@ -1362,7 +1380,8 @@ object Main { B("playJsonJsoniter")(benchmark.playJsonJsoniter()), B("smithy4sJson")(benchmark.smithy4sJson()), B("uPickle")(benchmark.uPickle()), - B("zioJson")(benchmark.zioJson()) + B("zioJson")(benchmark.zioJson()), + B("zioSchemaJson")(benchmark.zioSchemaJson()) )) }, { val benchmark = new OpenRTBReading { setup() } @@ -1376,7 +1395,8 @@ object Main { B("playJsonJsoniter")(benchmark.playJsonJsoniter()), B("smithy4sJson")(benchmark.smithy4sJson()), B("uPickle")(benchmark.uPickle()), - B("zioJson")(benchmark.zioJson()) + B("zioJson")(benchmark.zioJson()), + B("zioSchemaJson")(benchmark.zioSchemaJson()) )) }, { val benchmark = new OpenRTBWriting { setup() } @@ -1391,6 +1411,10 @@ object Main { B("playJsonJsoniter")(benchmark.playJsonJsoniter()), B("smithy4sJson")(benchmark.smithy4sJson()), B("uPickle")(benchmark.uPickle()) + //FIXME: zio-json serializes empty collections + //B("zioJson")(benchmark.zioJson()), + //FIXME: zio-schema-json serializes default values + //B("zioSchemaJson")(benchmark.zioSchemaJson()) )) }, { val benchmark = new PrimitivesReading { setup() } @@ -1404,7 +1428,8 @@ object Main { B("playJsonJsoniter")(benchmark.playJsonJsoniter()), B("smithy4sJson")(benchmark.smithy4sJson()), B("uPickle")(benchmark.uPickle()), - B("zioJson")(benchmark.zioJson()) + B("zioJson")(benchmark.zioJson()), + B("zioSchemaJson")(benchmark.zioSchemaJson()) )) }, { val benchmark = new PrimitivesWriting { setup() } @@ -1419,7 +1444,8 @@ object Main { B("playJsonJsoniter")(benchmark.playJsonJsoniter()), B("smithy4sJson")(benchmark.smithy4sJson()), B("uPickle")(benchmark.uPickle()), - B("zioJson")(benchmark.zioJson()) + B("zioJson")(benchmark.zioJson()), + B("zioSchemaJson")(benchmark.zioSchemaJson()) )) }, { val benchmark = new SetOfIntsReading { size = 128; setup() } @@ -1548,7 +1574,8 @@ object Main { B("playJsonJsoniter")(benchmark.playJsonJsoniter()), B("smithy4sJson")(benchmark.smithy4sJson()), B("uPickle")(benchmark.uPickle()), - B("zioJson")(benchmark.zioJson()) + B("zioJson")(benchmark.zioJson()), + B("zioSchemaJson")(benchmark.zioSchemaJson()) )) }, { val benchmark = new TwitterAPIWriting { setup() } @@ -1562,7 +1589,8 @@ object Main { B("playJson")(benchmark.playJson()), B("playJsonJsoniter")(benchmark.playJsonJsoniter()), B("smithy4sJson")(benchmark.smithy4sJson()), - B("uPickle")(benchmark.uPickle()) + B("uPickle")(benchmark.uPickle()), + B("zioSchemaJson")(benchmark.zioSchemaJson()) )) }, { val benchmark = new VectorOfBooleansReading { size = 128; setup() } diff --git a/jsoniter-scala-benchmark/js/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/Main.scala b/jsoniter-scala-benchmark/js/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/Main.scala index 640cf5f32..6109deead 100644 --- a/jsoniter-scala-benchmark/js/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/Main.scala +++ b/jsoniter-scala-benchmark/js/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/Main.scala @@ -25,6 +25,8 @@ object Main { B("smithy4sJson")(benchmark.smithy4sJson()), B("uPickle")(benchmark.uPickle()), B("zioJson")(benchmark.zioJson()) + //FIXME: zio-schema-json throws java.lang.RuntimeException: .type.Z.l.type(unrecognized subtype) + //B("zioSchemaJson")(benchmark.zioSchemaJson()) )) }, { val benchmark = new ADTWriting { setup() } @@ -39,6 +41,8 @@ object Main { B("smithy4sJson")(benchmark.smithy4sJson()), B("uPickle")(benchmark.uPickle()), B("zioJson")(benchmark.zioJson()) + //FIXME: zio-schema-json doesn't serialize the discriminator field + //B("zioSchemaJson")(benchmark.zioSchemaJson()) )) }, { val benchmark = new AnyValsReading { setup() } @@ -51,7 +55,8 @@ object Main { B("playJsonJsoniter")(benchmark.playJsonJsoniter()), B("smithy4sJson")(benchmark.smithy4sJson()), B("uPickle")(benchmark.uPickle()), - B("zioJson")(benchmark.zioJson()) + B("zioJson")(benchmark.zioJson()), + B("zioSchemaJson")(benchmark.zioSchemaJson()) )) }, { val benchmark = new AnyValsWriting { setup() } @@ -65,7 +70,8 @@ object Main { B("playJsonJsoniter")(benchmark.playJsonJsoniter()), B("smithy4sJson")(benchmark.smithy4sJson()), B("uPickle")(benchmark.uPickle()), - B("zioJson")(benchmark.zioJson()) + B("zioJson")(benchmark.zioJson()), + B("zioSchemaJson")(benchmark.zioSchemaJson()) )) }, { val benchmark = new ArrayBufferOfBooleansReading { size = 128; setup() } @@ -954,7 +960,8 @@ object Main { B("playJsonJsoniter")(benchmark.playJsonJsoniter()), B("smithy4sJson")(benchmark.smithy4sJson()), B("uPickle")(benchmark.uPickle()), - B("zioJson")(benchmark.zioJson()) + B("zioJson")(benchmark.zioJson()), + B("zioSchemaJson")(benchmark.zioSchemaJson()) )) }, { val benchmark = new GeoJSONReading { setup() } @@ -968,6 +975,8 @@ object Main { B("smithy4sJson")(benchmark.smithy4sJson()), B("uPickle")(benchmark.uPickle()), B("zioJson")(benchmark.zioJson()) + //FIXME: zio-schema-json throws java.lang.RuntimeException: .type.FeatureCollection.features[0].type.Feature.geometry.type.Polygon(unrecognized subtype) + //B("zioSchemaJson")(benchmark.zioSchemaJson()) )) }, { val benchmark = new GeoJSONWriting { setup() } @@ -981,7 +990,8 @@ object Main { B("playJsonJsoniter")(benchmark.playJsonJsoniter()), B("smithy4sJson")(benchmark.smithy4sJson()), B("uPickle")(benchmark.uPickle()), - B("zioJson")(benchmark.zioJson()) + B("zioJson")(benchmark.zioJson()), + B("zioSchemaJson")(benchmark.zioSchemaJson()) )) }, { val benchmark = new GitHubActionsAPIReading { setup() } @@ -993,7 +1003,8 @@ object Main { B("playJson")(benchmark.playJson()), B("playJsonJsoniter")(benchmark.playJsonJsoniter()), B("smithy4sJson")(benchmark.smithy4sJson()), - B("zioJson")(benchmark.zioJson()) + B("zioJson")(benchmark.zioJson()), + B("zioSchemaJson")(benchmark.zioSchemaJson()) )) }, { val benchmark = new GitHubActionsAPIWriting { setup() } @@ -1007,7 +1018,8 @@ object Main { B("playJsonJsoniter")(benchmark.playJsonJsoniter()), B("smithy4sJson")(benchmark.smithy4sJson()), B("uPickle")(benchmark.uPickle()), - B("zioJson")(benchmark.zioJson()) + B("zioJson")(benchmark.zioJson()), + B("zioSchemaJson")(benchmark.zioSchemaJson()) )) }, { val benchmark = new GoogleMapsAPIPrettyPrinting { setup() } @@ -1022,7 +1034,8 @@ object Main { B("playJsonJsoniter")(benchmark.playJsonJsoniter()), B("smithy4sJson")(benchmark.smithy4sJson()), B("uPickle")(benchmark.uPickle()), - B("zioJson")(benchmark.zioJson()) + B("zioJson")(benchmark.zioJson()), + B("zioSchemaJson")(benchmark.zioSchemaJson()) )) }, { val benchmark = new GoogleMapsAPIReading { setup() } @@ -1035,7 +1048,8 @@ object Main { B("playJsonJsoniter")(benchmark.playJsonJsoniter()), B("smithy4sJson")(benchmark.smithy4sJson()), B("uPickle")(benchmark.uPickle()), - B("zioJson")(benchmark.zioJson()) + B("zioJson")(benchmark.zioJson()), + B("zioSchemaJson")(benchmark.zioSchemaJson()) )) }, { val benchmark = new GoogleMapsAPIWriting { setup() } @@ -1049,7 +1063,8 @@ object Main { B("playJsonJsoniter")(benchmark.playJsonJsoniter()), B("smithy4sJson")(benchmark.smithy4sJson()), B("uPickle")(benchmark.uPickle()), - B("zioJson")(benchmark.zioJson()) + B("zioJson")(benchmark.zioJson()), + B("zioSchemaJson")(benchmark.zioSchemaJson()) )) }, { val benchmark = new IntMapOfBooleansReading { size = 128; setup() } @@ -1156,7 +1171,8 @@ object Main { B("playJsonJsoniter")(benchmark.playJsonJsoniter()), B("smithy4sJson")(benchmark.smithy4sJson()), B("uPickle")(benchmark.uPickle()), - B("zioJson")(benchmark.zioJson()) + B("zioJson")(benchmark.zioJson()), + B("zioSchemaJson")(benchmark.zioSchemaJson()) )) }, { val benchmark = new MutableBitSetReading { size = 128; setup() } @@ -1247,6 +1263,8 @@ object Main { B("smithy4sJson")(benchmark.smithy4sJson()), B("uPickle")(benchmark.uPickle()), B("zioJson")(benchmark.zioJson()) + //FIXME: zio-schema-json parses only 127 levels of nesting instead of 128 + //B("zioSchemaJson")(benchmark.zioSchemaJson()) )) }, { val benchmark = new NestedStructsWriting { size = 128; setup() } @@ -1259,7 +1277,8 @@ object Main { B("playJsonJsoniter")(benchmark.playJsonJsoniter()), B("smithy4sJson")(benchmark.smithy4sJson()), B("uPickle")(benchmark.uPickle()), - B("zioJson")(benchmark.zioJson()) + B("zioJson")(benchmark.zioJson()), + B("zioSchemaJson")(benchmark.zioSchemaJson()) )) }, { val benchmark = new OpenRTBReading { setup() } @@ -1272,7 +1291,8 @@ object Main { B("playJsonJsoniter")(benchmark.playJsonJsoniter()), B("smithy4sJson")(benchmark.smithy4sJson()), B("uPickle")(benchmark.uPickle()), - B("zioJson")(benchmark.zioJson()) + B("zioJson")(benchmark.zioJson()), + B("zioSchemaJson")(benchmark.zioSchemaJson()) )) }, { val benchmark = new OpenRTBWriting { setup() } @@ -1286,6 +1306,10 @@ object Main { B("playJsonJsoniter")(benchmark.playJsonJsoniter()), B("smithy4sJson")(benchmark.smithy4sJson()), B("uPickle")(benchmark.uPickle()) + //FIXME: zio-json serializes empty collections + //B("zioJson")(benchmark.zioJson()), + //FIXME: zio-schema-json serializes default values + //B("zioSchemaJson")(benchmark.zioSchemaJson()) )) }, { val benchmark = new PrimitivesReading { setup() } @@ -1298,7 +1322,8 @@ object Main { B("playJsonJsoniter")(benchmark.playJsonJsoniter()), B("smithy4sJson")(benchmark.smithy4sJson()), B("uPickle")(benchmark.uPickle()), - B("zioJson")(benchmark.zioJson()) + B("zioJson")(benchmark.zioJson()), + B("zioSchemaJson")(benchmark.zioSchemaJson()) )) }, { val benchmark = new PrimitivesWriting { setup() } @@ -1312,7 +1337,8 @@ object Main { B("playJsonJsoniter")(benchmark.playJsonJsoniter()), B("smithy4sJson")(benchmark.smithy4sJson()), B("uPickle")(benchmark.uPickle()), - B("zioJson")(benchmark.zioJson()) + B("zioJson")(benchmark.zioJson()), + B("zioSchemaJson")(benchmark.zioSchemaJson()) )) }, { val benchmark = new SetOfIntsReading { size = 128; setup() } @@ -1432,7 +1458,8 @@ object Main { B("playJsonJsoniter")(benchmark.playJsonJsoniter()), B("smithy4sJson")(benchmark.smithy4sJson()), B("uPickle")(benchmark.uPickle()), - B("zioJson")(benchmark.zioJson()) + B("zioJson")(benchmark.zioJson()), + B("zioSchemaJson")(benchmark.zioSchemaJson()) )) }, { val benchmark = new TwitterAPIWriting { setup() } @@ -1445,7 +1472,8 @@ object Main { B("playJson")(benchmark.playJson()), B("playJsonJsoniter")(benchmark.playJsonJsoniter()), B("smithy4sJson")(benchmark.smithy4sJson()), - B("uPickle")(benchmark.uPickle()) + B("uPickle")(benchmark.uPickle()), + B("zioSchemaJson")(benchmark.zioSchemaJson()) )) }, { val benchmark = new VectorOfBooleansReading { size = 128; setup() } diff --git a/jsoniter-scala-benchmark/js/src/test/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ADTReadingSpec.scala b/jsoniter-scala-benchmark/js/src/test/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ADTReadingSpec.scala index a1fb9f300..728611a72 100644 --- a/jsoniter-scala-benchmark/js/src/test/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ADTReadingSpec.scala +++ b/jsoniter-scala-benchmark/js/src/test/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ADTReadingSpec.scala @@ -19,6 +19,8 @@ class ADTReadingSpec extends BenchmarkSpecBase { benchmark.smithy4sJson() shouldBe benchmark.obj benchmark.uPickle() shouldBe benchmark.obj benchmark.zioJson() shouldBe benchmark.obj + //FIXME: zio-schema-json throws java.lang.RuntimeException: .type.Z.l.type(unrecognized subtype) + //benchmark.zioSchemaJson() shouldBe benchmark.obj } "fail on invalid input" in { val b = benchmark @@ -33,6 +35,8 @@ class ADTReadingSpec extends BenchmarkSpecBase { intercept[Throwable](b.smithy4sJson()) intercept[Throwable](b.uPickle()) intercept[Throwable](b.zioJson()) + //FIXME: zio-schema-json throws java.lang.RuntimeException: .type.Z.l.type(unrecognized subtype) + //intercept[Throwable](b.zioSchemaJson()) } } } \ No newline at end of file diff --git a/jsoniter-scala-benchmark/js/src/test/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ADTWritingSpec.scala b/jsoniter-scala-benchmark/js/src/test/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ADTWritingSpec.scala index 83892ab50..2d19b67a2 100644 --- a/jsoniter-scala-benchmark/js/src/test/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ADTWritingSpec.scala +++ b/jsoniter-scala-benchmark/js/src/test/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ADTWritingSpec.scala @@ -18,7 +18,8 @@ class ADTWritingSpec extends BenchmarkSpecBase { toString(b.playJsonJsoniter()) shouldBe b.jsonString1 toString(b.smithy4sJson()) shouldBe b.jsonString1 toString(b.uPickle()) shouldBe b.jsonString1 - toString(b.zioJson()) shouldBe b.jsonString1 + //FIXME: zio-schema-json doesn't serialize the discriminator field + //toString(b.zioJson()) shouldBe b.jsonString1 } } } \ No newline at end of file diff --git a/jsoniter-scala-benchmark/js/src/test/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/AnyValsReadingSpec.scala b/jsoniter-scala-benchmark/js/src/test/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/AnyValsReadingSpec.scala index 1890122bc..756746cbd 100644 --- a/jsoniter-scala-benchmark/js/src/test/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/AnyValsReadingSpec.scala +++ b/jsoniter-scala-benchmark/js/src/test/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/AnyValsReadingSpec.scala @@ -19,6 +19,7 @@ class AnyValsReadingSpec extends BenchmarkSpecBase { benchmark.smithy4sJson() shouldBe benchmark.obj benchmark.uPickle() shouldBe benchmark.obj benchmark.zioJson() shouldBe benchmark.obj + benchmark.zioSchemaJson() shouldBe benchmark.obj } "fail on invalid input" in { val b = benchmark @@ -32,7 +33,7 @@ class AnyValsReadingSpec extends BenchmarkSpecBase { intercept[Throwable](b.playJsonJsoniter()) intercept[Throwable](b.smithy4sJson()) intercept[Throwable](b.uPickle()) - intercept[Throwable](b.zioJson()) + intercept[Throwable](b.zioSchemaJson()) } } } \ No newline at end of file diff --git a/jsoniter-scala-benchmark/js/src/test/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/AnyValsWritingSpec.scala b/jsoniter-scala-benchmark/js/src/test/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/AnyValsWritingSpec.scala index 4a3f29f57..ca8bfe4bb 100644 --- a/jsoniter-scala-benchmark/js/src/test/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/AnyValsWritingSpec.scala +++ b/jsoniter-scala-benchmark/js/src/test/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/AnyValsWritingSpec.scala @@ -19,6 +19,7 @@ class AnyValsWritingSpec extends BenchmarkSpecBase { toString(b.smithy4sJson()) shouldBe b.jsonString1 toString(b.uPickle()) shouldBe b.jsonString3 toString(b.zioJson()) shouldBe b.jsonString1 + toString(b.zioSchemaJson()) shouldBe b.jsonString1 } } } \ No newline at end of file diff --git a/jsoniter-scala-benchmark/js/src/test/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ExtractFieldsReadingSpec.scala b/jsoniter-scala-benchmark/js/src/test/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ExtractFieldsReadingSpec.scala index 340b3aab2..086fd51b2 100644 --- a/jsoniter-scala-benchmark/js/src/test/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ExtractFieldsReadingSpec.scala +++ b/jsoniter-scala-benchmark/js/src/test/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ExtractFieldsReadingSpec.scala @@ -19,6 +19,7 @@ class ExtractFieldsReadingSpec extends BenchmarkSpecBase { benchmark.smithy4sJson() shouldBe benchmark.obj benchmark.uPickle() shouldBe benchmark.obj benchmark.zioJson() shouldBe benchmark.obj + benchmark.zioSchemaJson() shouldBe benchmark.obj } "fail on invalid input" in { val b = benchmark @@ -33,6 +34,7 @@ class ExtractFieldsReadingSpec extends BenchmarkSpecBase { intercept[Throwable](b.smithy4sJson()) intercept[Throwable](b.uPickle()) intercept[Throwable](b.zioJson()) + intercept[Throwable](b.zioSchemaJson()) } } } \ No newline at end of file diff --git a/jsoniter-scala-benchmark/js/src/test/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/GeoJSONReadingSpec.scala b/jsoniter-scala-benchmark/js/src/test/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/GeoJSONReadingSpec.scala index 8a1a52637..8c7054aee 100644 --- a/jsoniter-scala-benchmark/js/src/test/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/GeoJSONReadingSpec.scala +++ b/jsoniter-scala-benchmark/js/src/test/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/GeoJSONReadingSpec.scala @@ -19,6 +19,8 @@ class GeoJSONReadingSpec extends BenchmarkSpecBase { benchmark.smithy4sJson() shouldBe benchmark.obj benchmark.uPickle() shouldBe benchmark.obj benchmark.zioJson() shouldBe benchmark.obj + //FIXME: zio-schema-json throws java.lang.RuntimeException: .type.FeatureCollection.features[0].type.Feature.geometry.type.Polygon(unrecognized subtype) + //benchmark.zioSchemaJson() shouldBe benchmark.obj } "fail on invalid input" in { val b = benchmark @@ -33,6 +35,8 @@ class GeoJSONReadingSpec extends BenchmarkSpecBase { intercept[Throwable](b.smithy4sJson()) intercept[Throwable](b.uPickle()) intercept[Throwable](b.zioJson()) + //FIXME: zio-schema-json throws java.lang.RuntimeException: .type.FeatureCollection.features[0].type.Feature.geometry.type.Polygon(unrecognized subtype) + //intercept[Throwable](b.zioSchemaJson()) } } } \ No newline at end of file diff --git a/jsoniter-scala-benchmark/js/src/test/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/GeoJSONWritingSpec.scala b/jsoniter-scala-benchmark/js/src/test/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/GeoJSONWritingSpec.scala index 3043f3176..56283611b 100644 --- a/jsoniter-scala-benchmark/js/src/test/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/GeoJSONWritingSpec.scala +++ b/jsoniter-scala-benchmark/js/src/test/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/GeoJSONWritingSpec.scala @@ -19,6 +19,7 @@ class GeoJSONWritingSpec extends BenchmarkSpecBase { toString(b.smithy4sJson()) shouldBe b.jsonString1 toString(b.uPickle()) shouldBe b.jsonString1 toString(b.zioJson()) shouldBe b.jsonString1 + toString(b.zioSchemaJson()) shouldBe b.jsonString1 } } } \ No newline at end of file diff --git a/jsoniter-scala-benchmark/js/src/test/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/GitHubActionsAPIReadingSpec.scala b/jsoniter-scala-benchmark/js/src/test/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/GitHubActionsAPIReadingSpec.scala index 5f4995bb4..da56c56ed 100644 --- a/jsoniter-scala-benchmark/js/src/test/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/GitHubActionsAPIReadingSpec.scala +++ b/jsoniter-scala-benchmark/js/src/test/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/GitHubActionsAPIReadingSpec.scala @@ -19,6 +19,7 @@ class GitHubActionsAPIReadingSpec extends BenchmarkSpecBase { benchmark.smithy4sJson() shouldBe benchmark.obj benchmark.uPickle() shouldBe benchmark.obj benchmark.zioJson() shouldBe benchmark.obj + benchmark.zioSchemaJson() shouldBe benchmark.obj } "fail on invalid input" in { val b = benchmark @@ -33,6 +34,7 @@ class GitHubActionsAPIReadingSpec extends BenchmarkSpecBase { intercept[Throwable](b.smithy4sJson()) intercept[Throwable](b.uPickle()) intercept[Throwable](b.zioJson()) + intercept[Throwable](b.zioSchemaJson()) } } } \ No newline at end of file diff --git a/jsoniter-scala-benchmark/js/src/test/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/GitHubActionsAPIWritingSpec.scala b/jsoniter-scala-benchmark/js/src/test/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/GitHubActionsAPIWritingSpec.scala index ab8051b3a..5beb11eb8 100644 --- a/jsoniter-scala-benchmark/js/src/test/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/GitHubActionsAPIWritingSpec.scala +++ b/jsoniter-scala-benchmark/js/src/test/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/GitHubActionsAPIWritingSpec.scala @@ -19,6 +19,7 @@ class GitHubActionsAPIWritingSpec extends BenchmarkSpecBase { toString(b.smithy4sJson()) shouldBe b.compactJsonString1 toString(b.uPickle()) shouldBe b.compactJsonString1 toString(b.zioJson()) shouldBe b.compactJsonString1 + toString(b.zioSchemaJson()) shouldBe b.compactJsonString1 } } } \ No newline at end of file diff --git a/jsoniter-scala-benchmark/js/src/test/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/GoogleMapsAPIPrettyPrintingSpec.scala b/jsoniter-scala-benchmark/js/src/test/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/GoogleMapsAPIPrettyPrintingSpec.scala index cd5d12082..de356e262 100644 --- a/jsoniter-scala-benchmark/js/src/test/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/GoogleMapsAPIPrettyPrintingSpec.scala +++ b/jsoniter-scala-benchmark/js/src/test/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/GoogleMapsAPIPrettyPrintingSpec.scala @@ -19,6 +19,7 @@ class GoogleMapsAPIPrettyPrintingSpec extends BenchmarkSpecBase { toString(b.smithy4sJson()) shouldBe b.jsonString2 toString(b.uPickle()) shouldBe b.jsonString2 toString(b.zioJson()) shouldBe b.jsonString1 + toString(b.zioSchemaJson()) shouldBe b.jsonString1 } } } \ No newline at end of file diff --git a/jsoniter-scala-benchmark/js/src/test/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/GoogleMapsAPIReadingSpec.scala b/jsoniter-scala-benchmark/js/src/test/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/GoogleMapsAPIReadingSpec.scala index fec4a8d47..ac9087e8e 100644 --- a/jsoniter-scala-benchmark/js/src/test/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/GoogleMapsAPIReadingSpec.scala +++ b/jsoniter-scala-benchmark/js/src/test/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/GoogleMapsAPIReadingSpec.scala @@ -19,6 +19,7 @@ class GoogleMapsAPIReadingSpec extends BenchmarkSpecBase { benchmark.smithy4sJson() shouldBe benchmark.obj benchmark.uPickle() shouldBe benchmark.obj benchmark.zioJson() shouldBe benchmark.obj + benchmark.zioSchemaJson() shouldBe benchmark.obj } "fail on invalid input" in { val b = benchmark @@ -33,6 +34,7 @@ class GoogleMapsAPIReadingSpec extends BenchmarkSpecBase { intercept[Throwable](b.smithy4sJson()) intercept[Throwable](b.uPickle()) intercept[Throwable](b.zioJson()) + intercept[Throwable](b.zioSchemaJson()) } } } \ No newline at end of file diff --git a/jsoniter-scala-benchmark/js/src/test/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/GoogleMapsAPIWritingSpec.scala b/jsoniter-scala-benchmark/js/src/test/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/GoogleMapsAPIWritingSpec.scala index 798f90e98..f4f26d8b9 100644 --- a/jsoniter-scala-benchmark/js/src/test/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/GoogleMapsAPIWritingSpec.scala +++ b/jsoniter-scala-benchmark/js/src/test/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/GoogleMapsAPIWritingSpec.scala @@ -19,6 +19,7 @@ class GoogleMapsAPIWritingSpec extends BenchmarkSpecBase { toString(b.smithy4sJson()) shouldBe b.compactJsonString1 toString(b.uPickle()) shouldBe b.compactJsonString1 toString(b.zioJson()) shouldBe b.compactJsonString1 + toString(b.zioSchemaJson()) shouldBe b.compactJsonString1 } } } \ No newline at end of file diff --git a/jsoniter-scala-benchmark/js/src/test/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/MissingRequiredFieldsReadingSpec.scala b/jsoniter-scala-benchmark/js/src/test/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/MissingRequiredFieldsReadingSpec.scala index 69c8e189c..326b918a9 100644 --- a/jsoniter-scala-benchmark/js/src/test/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/MissingRequiredFieldsReadingSpec.scala +++ b/jsoniter-scala-benchmark/js/src/test/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/MissingRequiredFieldsReadingSpec.scala @@ -36,6 +36,7 @@ class MissingRequiredFieldsReadingSpec extends BenchmarkSpecBase { b.smithy4sJson() shouldBe "Missing required field (path: .s)" b.uPickle() shouldBe "missing keys in dictionary: s, i at index 1" b.zioJson() shouldBe ".s(missing)" + b.zioSchemaJson() shouldBe ".s(missing)" } "return toString value for valid input" in { val b = benchmark @@ -52,6 +53,7 @@ class MissingRequiredFieldsReadingSpec extends BenchmarkSpecBase { b.smithy4sJson() shouldBe "MissingRequiredFields(VVV,1)" b.uPickle() shouldBe "MissingRequiredFields(VVV,1)" b.zioJson() shouldBe "MissingRequiredFields(VVV,1)" + b.zioSchemaJson() shouldBe "MissingRequiredFields(VVV,1)" } } } \ No newline at end of file diff --git a/jsoniter-scala-benchmark/js/src/test/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/NestedStructsReadingSpec.scala b/jsoniter-scala-benchmark/js/src/test/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/NestedStructsReadingSpec.scala index c00910daf..84a0f20e6 100644 --- a/jsoniter-scala-benchmark/js/src/test/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/NestedStructsReadingSpec.scala +++ b/jsoniter-scala-benchmark/js/src/test/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/NestedStructsReadingSpec.scala @@ -20,6 +20,8 @@ class NestedStructsReadingSpec extends BenchmarkSpecBase { benchmark.smithy4sJson() shouldBe benchmark.obj benchmark.uPickle() shouldBe benchmark.obj benchmark.zioJson() shouldBe benchmark.obj + //FIXME: zio-schema-json parses only 127 levels of nesting instead of 128 + //benchmark.zioSchemaJson() shouldBe benchmark.obj } "fail on invalid input" in { val b = benchmark @@ -32,7 +34,8 @@ class NestedStructsReadingSpec extends BenchmarkSpecBase { intercept[Throwable](b.playJsonJsoniter()) intercept[Throwable](b.smithy4sJson()) intercept[Throwable](b.uPickle()) - intercept[Throwable](b.zioJson()) + //FIXME: zio-schema-json parses only 127 levels of nesting instead of 128 + //intercept[Throwable](b.zioJson()) } } } \ No newline at end of file diff --git a/jsoniter-scala-benchmark/js/src/test/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/NestedStructsWritingSpec.scala b/jsoniter-scala-benchmark/js/src/test/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/NestedStructsWritingSpec.scala index 483fd1140..a5b66b01d 100644 --- a/jsoniter-scala-benchmark/js/src/test/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/NestedStructsWritingSpec.scala +++ b/jsoniter-scala-benchmark/js/src/test/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/NestedStructsWritingSpec.scala @@ -20,6 +20,7 @@ class NestedStructsWritingSpec extends BenchmarkSpecBase { toString(b.smithy4sJson()) shouldBe b.jsonString toString(b.uPickle()) shouldBe b.jsonString toString(b.zioJson()) shouldBe b.jsonString + toString(b.zioSchemaJson()) shouldBe b.jsonString } } } \ No newline at end of file diff --git a/jsoniter-scala-benchmark/js/src/test/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/OpenRTBReadingSpec.scala b/jsoniter-scala-benchmark/js/src/test/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/OpenRTBReadingSpec.scala index 520c668ba..056f454b8 100644 --- a/jsoniter-scala-benchmark/js/src/test/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/OpenRTBReadingSpec.scala +++ b/jsoniter-scala-benchmark/js/src/test/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/OpenRTBReadingSpec.scala @@ -19,6 +19,7 @@ class OpenRTBReadingSpec extends BenchmarkSpecBase { benchmark.smithy4sJson() shouldBe benchmark.obj benchmark.uPickle() shouldBe benchmark.obj benchmark.zioJson() shouldBe benchmark.obj + benchmark.zioSchemaJson() shouldBe benchmark.obj } "fail on invalid input" in { val b = benchmark @@ -33,6 +34,7 @@ class OpenRTBReadingSpec extends BenchmarkSpecBase { intercept[Throwable](b.smithy4sJson()) intercept[Throwable](b.uPickle()) intercept[Throwable](b.zioJson()) + intercept[Throwable](b.zioSchemaJson()) } } } \ No newline at end of file diff --git a/jsoniter-scala-benchmark/js/src/test/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/OpenRTBWritingSpec.scala b/jsoniter-scala-benchmark/js/src/test/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/OpenRTBWritingSpec.scala index 15c92317e..449d4c4c4 100644 --- a/jsoniter-scala-benchmark/js/src/test/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/OpenRTBWritingSpec.scala +++ b/jsoniter-scala-benchmark/js/src/test/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/OpenRTBWritingSpec.scala @@ -18,8 +18,10 @@ class OpenRTBWritingSpec extends BenchmarkSpecBase { toString(b.playJsonJsoniter()) shouldBe b.jsonString1 toString(b.smithy4sJson()) shouldBe b.jsonString1 toString(b.uPickle()) shouldBe b.jsonString1 - //FIXME: Zio-JSON serializes empty collections + //FIXME: zio-json serializes empty collections //toString(b.zioJson()) shouldBe b.jsonString1 + //FIXME: zio-schema-json serializes default values + //toString(b.zioSchemaJson()) shouldBe b.jsonString1 } } } \ No newline at end of file diff --git a/jsoniter-scala-benchmark/js/src/test/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/PrimitivesReadingSpec.scala b/jsoniter-scala-benchmark/js/src/test/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/PrimitivesReadingSpec.scala index 0a9f3a889..3befc39b9 100644 --- a/jsoniter-scala-benchmark/js/src/test/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/PrimitivesReadingSpec.scala +++ b/jsoniter-scala-benchmark/js/src/test/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/PrimitivesReadingSpec.scala @@ -19,6 +19,7 @@ class PrimitivesReadingSpec extends BenchmarkSpecBase { benchmark.smithy4sJson() shouldBe benchmark.obj benchmark.uPickle() shouldBe benchmark.obj benchmark.zioJson() shouldBe benchmark.obj + benchmark.zioSchemaJson() shouldBe benchmark.obj } "fail on invalid input" in { val b = benchmark @@ -33,6 +34,7 @@ class PrimitivesReadingSpec extends BenchmarkSpecBase { intercept[Throwable](b.smithy4sJson()) intercept[Throwable](b.uPickle()) intercept[Throwable](b.zioJson()) + intercept[Throwable](b.zioSchemaJson()) } } } \ No newline at end of file diff --git a/jsoniter-scala-benchmark/js/src/test/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/PrimitivesWritingSpec.scala b/jsoniter-scala-benchmark/js/src/test/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/PrimitivesWritingSpec.scala index 14663a640..197c66ca1 100644 --- a/jsoniter-scala-benchmark/js/src/test/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/PrimitivesWritingSpec.scala +++ b/jsoniter-scala-benchmark/js/src/test/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/PrimitivesWritingSpec.scala @@ -19,6 +19,7 @@ class PrimitivesWritingSpec extends BenchmarkSpecBase { toString(b.smithy4sJson()) shouldBe b.jsonString1 toString(b.uPickle()) shouldBe b.jsonString3 toString(b.zioJson()) shouldBe b.jsonString1 + toString(b.zioSchemaJson()) shouldBe b.jsonString1 } } } \ No newline at end of file diff --git a/jsoniter-scala-benchmark/js/src/test/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/TwitterAPIReadingSpec.scala b/jsoniter-scala-benchmark/js/src/test/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/TwitterAPIReadingSpec.scala index 5cf0a2575..dc92aa45b 100644 --- a/jsoniter-scala-benchmark/js/src/test/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/TwitterAPIReadingSpec.scala +++ b/jsoniter-scala-benchmark/js/src/test/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/TwitterAPIReadingSpec.scala @@ -20,6 +20,7 @@ class TwitterAPIReadingSpec extends BenchmarkSpecBase { benchmark.smithy4sJson() shouldBe benchmark.obj benchmark.uPickle() shouldBe benchmark.obj benchmark.zioJson() shouldBe benchmark.obj + benchmark.zioSchemaJson() shouldBe benchmark.obj } "fail on invalid input" in { val b = benchmark @@ -34,6 +35,7 @@ class TwitterAPIReadingSpec extends BenchmarkSpecBase { intercept[Throwable](b.smithy4sJson()) intercept[Throwable](b.uPickle()) intercept[Throwable](b.zioJson()) + intercept[Throwable](b.zioSchemaJson()) } } } \ No newline at end of file diff --git a/jsoniter-scala-benchmark/js/src/test/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/TwitterAPIWritingSpec.scala b/jsoniter-scala-benchmark/js/src/test/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/TwitterAPIWritingSpec.scala index 596abe697..f997b1fb9 100644 --- a/jsoniter-scala-benchmark/js/src/test/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/TwitterAPIWritingSpec.scala +++ b/jsoniter-scala-benchmark/js/src/test/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/TwitterAPIWritingSpec.scala @@ -18,8 +18,9 @@ class TwitterAPIWritingSpec extends BenchmarkSpecBase { toString(b.playJsonJsoniter()) shouldBe b.compactJsonString1 toString(b.smithy4sJson()) shouldBe b.compactJsonString1 toString(b.uPickle()) shouldBe b.compactJsonString1 - //FIXME: Zio-JSON serializes empty collections - //toString(b.zioJson()) shouldBe b.compactJsonString + //FIXME: zio-json serializes empty collections + //toString(b.zioJson()) shouldBe b.compactJsonString1 + toString(b.zioSchemaJson()) shouldBe b.compactJsonString1 } } } \ No newline at end of file diff --git a/jsoniter-scala-benchmark/js/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ADTReadingSpec.scala b/jsoniter-scala-benchmark/js/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ADTReadingSpec.scala index 623767cee..acbf4f029 100644 --- a/jsoniter-scala-benchmark/js/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ADTReadingSpec.scala +++ b/jsoniter-scala-benchmark/js/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ADTReadingSpec.scala @@ -18,6 +18,8 @@ class ADTReadingSpec extends BenchmarkSpecBase { benchmark.smithy4sJson() shouldBe benchmark.obj benchmark.uPickle() shouldBe benchmark.obj benchmark.zioJson() shouldBe benchmark.obj + //FIXME: zio-schema-json throws java.lang.RuntimeException: .type.Z.l.type(unrecognized subtype) + //benchmark.zioSchemaJson() shouldBe benchmark.obj } "fail on invalid input" in { val b = benchmark @@ -31,6 +33,8 @@ class ADTReadingSpec extends BenchmarkSpecBase { intercept[Throwable](b.smithy4sJson()) intercept[Throwable](b.uPickle()) intercept[Throwable](b.zioJson()) + //FIXME: zio-schema-json throws java.lang.RuntimeException: .type.Z.l.type(unrecognized subtype) + //intercept[Throwable](b.zioJson()) } } } \ No newline at end of file diff --git a/jsoniter-scala-benchmark/js/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ADTWritingSpec.scala b/jsoniter-scala-benchmark/js/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ADTWritingSpec.scala index e2ca9fece..4ff371d9b 100644 --- a/jsoniter-scala-benchmark/js/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ADTWritingSpec.scala +++ b/jsoniter-scala-benchmark/js/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ADTWritingSpec.scala @@ -18,6 +18,8 @@ class ADTWritingSpec extends BenchmarkSpecBase { toString(b.smithy4sJson()) shouldBe b.jsonString1 toString(b.uPickle()) shouldBe b.jsonString1 toString(b.zioJson()) shouldBe b.jsonString1 + //FIXME: zio-schema-json doesn't serialize the discriminator field + //toString(b.zioSchemaJson()) shouldBe b.jsonString1 } } } \ No newline at end of file diff --git a/jsoniter-scala-benchmark/js/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/AnyValsReadingSpec.scala b/jsoniter-scala-benchmark/js/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/AnyValsReadingSpec.scala index d5144eb70..a13772dc0 100644 --- a/jsoniter-scala-benchmark/js/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/AnyValsReadingSpec.scala +++ b/jsoniter-scala-benchmark/js/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/AnyValsReadingSpec.scala @@ -18,6 +18,7 @@ class AnyValsReadingSpec extends BenchmarkSpecBase { benchmark.smithy4sJson() shouldBe benchmark.obj benchmark.uPickle() shouldBe benchmark.obj benchmark.zioJson() shouldBe benchmark.obj + benchmark.zioSchemaJson() shouldBe benchmark.obj } "fail on invalid input" in { val b = benchmark @@ -31,6 +32,7 @@ class AnyValsReadingSpec extends BenchmarkSpecBase { intercept[Throwable](b.smithy4sJson()) intercept[Throwable](b.uPickle()) intercept[Throwable](b.zioJson()) + intercept[Throwable](b.zioSchemaJson()) } } } \ No newline at end of file diff --git a/jsoniter-scala-benchmark/js/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ExtractFieldsReadingSpec.scala b/jsoniter-scala-benchmark/js/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ExtractFieldsReadingSpec.scala index e33009eae..130f38335 100644 --- a/jsoniter-scala-benchmark/js/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ExtractFieldsReadingSpec.scala +++ b/jsoniter-scala-benchmark/js/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ExtractFieldsReadingSpec.scala @@ -18,6 +18,7 @@ class ExtractFieldsReadingSpec extends BenchmarkSpecBase { benchmark.smithy4sJson() shouldBe benchmark.obj benchmark.uPickle() shouldBe benchmark.obj benchmark.zioJson() shouldBe benchmark.obj + benchmark.zioSchemaJson() shouldBe benchmark.obj } "fail on invalid input" in { val b = benchmark @@ -31,6 +32,7 @@ class ExtractFieldsReadingSpec extends BenchmarkSpecBase { intercept[Throwable](b.smithy4sJson()) intercept[Throwable](b.uPickle()) intercept[Throwable](b.zioJson()) + intercept[Throwable](b.zioSchemaJson()) } } } \ No newline at end of file diff --git a/jsoniter-scala-benchmark/js/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/GeoJSONReadingSpec.scala b/jsoniter-scala-benchmark/js/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/GeoJSONReadingSpec.scala index 0baadf501..04b225763 100644 --- a/jsoniter-scala-benchmark/js/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/GeoJSONReadingSpec.scala +++ b/jsoniter-scala-benchmark/js/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/GeoJSONReadingSpec.scala @@ -18,6 +18,8 @@ class GeoJSONReadingSpec extends BenchmarkSpecBase { benchmark.smithy4sJson() shouldBe benchmark.obj benchmark.uPickle() shouldBe benchmark.obj benchmark.zioJson() shouldBe benchmark.obj + //FIXME: zio-schema-json throws java.lang.RuntimeException: .type.FeatureCollection.features[0].type.Feature.geometry.type.Polygon(unrecognized subtype) + //benchmark.zioSchemaJson() shouldBe benchmark.obj } "fail on invalid input" in { val b = benchmark @@ -31,6 +33,8 @@ class GeoJSONReadingSpec extends BenchmarkSpecBase { intercept[Throwable](b.smithy4sJson()) intercept[Throwable](b.uPickle()) intercept[Throwable](b.zioJson()) + //FIXME: zio-schema-json throws java.lang.RuntimeException: .type.FeatureCollection.features[0].type.Feature.geometry.type.Polygon(unrecognized subtype) + //intercept[Throwable](b.zioSchemaJson()) } } } \ No newline at end of file diff --git a/jsoniter-scala-benchmark/js/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/GeoJSONWritingSpec.scala b/jsoniter-scala-benchmark/js/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/GeoJSONWritingSpec.scala index 49b6b6502..bbfcb4ea2 100644 --- a/jsoniter-scala-benchmark/js/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/GeoJSONWritingSpec.scala +++ b/jsoniter-scala-benchmark/js/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/GeoJSONWritingSpec.scala @@ -18,6 +18,7 @@ class GeoJSONWritingSpec extends BenchmarkSpecBase { toString(b.smithy4sJson()) shouldBe b.jsonString1 toString(b.uPickle()) shouldBe b.jsonString1 toString(b.zioJson()) shouldBe b.jsonString1 + toString(b.zioSchemaJson()) shouldBe b.jsonString1 } } } \ No newline at end of file diff --git a/jsoniter-scala-benchmark/js/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/GitHubActionsAPIReadingSpec.scala b/jsoniter-scala-benchmark/js/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/GitHubActionsAPIReadingSpec.scala index 532d4e100..5ba851c73 100644 --- a/jsoniter-scala-benchmark/js/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/GitHubActionsAPIReadingSpec.scala +++ b/jsoniter-scala-benchmark/js/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/GitHubActionsAPIReadingSpec.scala @@ -18,6 +18,7 @@ class GitHubActionsAPIReadingSpec extends BenchmarkSpecBase { benchmark.smithy4sJson() shouldBe benchmark.obj benchmark.uPickle() shouldBe benchmark.obj benchmark.zioJson() shouldBe benchmark.obj + benchmark.zioSchemaJson() shouldBe benchmark.obj } "fail on invalid input" in { val b = benchmark @@ -31,6 +32,7 @@ class GitHubActionsAPIReadingSpec extends BenchmarkSpecBase { intercept[Throwable](b.smithy4sJson()) intercept[Throwable](b.uPickle()) intercept[Throwable](b.zioJson()) + intercept[Throwable](b.zioSchemaJson()) } } } \ No newline at end of file diff --git a/jsoniter-scala-benchmark/js/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/GitHubActionsAPIWritingSpec.scala b/jsoniter-scala-benchmark/js/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/GitHubActionsAPIWritingSpec.scala index 5d48f9716..2e36386e7 100644 --- a/jsoniter-scala-benchmark/js/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/GitHubActionsAPIWritingSpec.scala +++ b/jsoniter-scala-benchmark/js/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/GitHubActionsAPIWritingSpec.scala @@ -18,6 +18,7 @@ class GitHubActionsAPIWritingSpec extends BenchmarkSpecBase { toString(b.smithy4sJson()) shouldBe b.compactJsonString1 toString(b.uPickle()) shouldBe b.compactJsonString1 toString(b.zioJson()) shouldBe b.compactJsonString1 + toString(b.zioSchemaJson()) shouldBe b.compactJsonString1 } } } \ No newline at end of file diff --git a/jsoniter-scala-benchmark/js/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/GoogleMapsAPIPrettyPrintingSpec.scala b/jsoniter-scala-benchmark/js/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/GoogleMapsAPIPrettyPrintingSpec.scala index b041dcf4f..89566f6e9 100644 --- a/jsoniter-scala-benchmark/js/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/GoogleMapsAPIPrettyPrintingSpec.scala +++ b/jsoniter-scala-benchmark/js/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/GoogleMapsAPIPrettyPrintingSpec.scala @@ -19,6 +19,7 @@ class GoogleMapsAPIPrettyPrintingSpec extends BenchmarkSpecBase { toString(b.smithy4sJson()) shouldBe b.jsonString2 toString(b.uPickle()) shouldBe b.jsonString2 toString(b.zioJson()) shouldBe b.jsonString1 + toString(b.zioSchemaJson()) shouldBe b.jsonString1 } } } \ No newline at end of file diff --git a/jsoniter-scala-benchmark/js/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/GoogleMapsAPIReadingSpec.scala b/jsoniter-scala-benchmark/js/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/GoogleMapsAPIReadingSpec.scala index 6df42276c..8f78f3ebb 100644 --- a/jsoniter-scala-benchmark/js/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/GoogleMapsAPIReadingSpec.scala +++ b/jsoniter-scala-benchmark/js/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/GoogleMapsAPIReadingSpec.scala @@ -18,6 +18,7 @@ class GoogleMapsAPIReadingSpec extends BenchmarkSpecBase { benchmark.smithy4sJson() shouldBe benchmark.obj benchmark.uPickle() shouldBe benchmark.obj benchmark.zioJson() shouldBe benchmark.obj + benchmark.zioSchemaJson() shouldBe benchmark.obj } "fail on invalid input" in { val b = benchmark @@ -31,6 +32,7 @@ class GoogleMapsAPIReadingSpec extends BenchmarkSpecBase { intercept[Throwable](b.smithy4sJson()) intercept[Throwable](b.uPickle()) intercept[Throwable](b.zioJson()) + intercept[Throwable](b.zioSchemaJson()) } } } \ No newline at end of file diff --git a/jsoniter-scala-benchmark/js/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/GoogleMapsAPIWritingSpec.scala b/jsoniter-scala-benchmark/js/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/GoogleMapsAPIWritingSpec.scala index c1377583b..bbde052b9 100644 --- a/jsoniter-scala-benchmark/js/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/GoogleMapsAPIWritingSpec.scala +++ b/jsoniter-scala-benchmark/js/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/GoogleMapsAPIWritingSpec.scala @@ -18,6 +18,7 @@ class GoogleMapsAPIWritingSpec extends BenchmarkSpecBase { toString(b.smithy4sJson()) shouldBe b.compactJsonString1 toString(b.uPickle()) shouldBe b.compactJsonString1 toString(b.zioJson()) shouldBe b.compactJsonString1 + toString(b.zioSchemaJson()) shouldBe b.compactJsonString1 } } } \ No newline at end of file diff --git a/jsoniter-scala-benchmark/js/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/MissingRequiredFieldsReadingSpec.scala b/jsoniter-scala-benchmark/js/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/MissingRequiredFieldsReadingSpec.scala index 9c36bb8a2..faedc957b 100644 --- a/jsoniter-scala-benchmark/js/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/MissingRequiredFieldsReadingSpec.scala +++ b/jsoniter-scala-benchmark/js/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/MissingRequiredFieldsReadingSpec.scala @@ -34,6 +34,7 @@ class MissingRequiredFieldsReadingSpec extends BenchmarkSpecBase { b.smithy4sJson() shouldBe "Missing required field (path: .s)" b.uPickle() shouldBe "missing keys in dictionary: s, i at index 1" b.zioJson() shouldBe ".s(missing)" + b.zioSchemaJson() shouldBe ".s(missing)" } "return toString value for valid input" in { val b = benchmark @@ -49,6 +50,7 @@ class MissingRequiredFieldsReadingSpec extends BenchmarkSpecBase { b.smithy4sJson() shouldBe "MissingRequiredFields(VVV,1)" b.uPickle() shouldBe "MissingRequiredFields(VVV,1)" b.zioJson() shouldBe "MissingRequiredFields(VVV,1)" + b.zioSchemaJson() shouldBe "MissingRequiredFields(VVV,1)" } } } \ No newline at end of file diff --git a/jsoniter-scala-benchmark/js/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/NestedStructsReadingSpec.scala b/jsoniter-scala-benchmark/js/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/NestedStructsReadingSpec.scala index 0f997480b..cefbdc806 100644 --- a/jsoniter-scala-benchmark/js/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/NestedStructsReadingSpec.scala +++ b/jsoniter-scala-benchmark/js/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/NestedStructsReadingSpec.scala @@ -19,6 +19,8 @@ class NestedStructsReadingSpec extends BenchmarkSpecBase { benchmark.smithy4sJson() shouldBe benchmark.obj benchmark.uPickle() shouldBe benchmark.obj benchmark.zioJson() shouldBe benchmark.obj + //FIXME: zio-schema-json parses only 127 levels of nesting instead of 128 + //benchmark.zioSchemaJson() shouldBe benchmark.obj } "fail on invalid input" in { val b = benchmark @@ -31,6 +33,8 @@ class NestedStructsReadingSpec extends BenchmarkSpecBase { intercept[Throwable](b.smithy4sJson()) intercept[Throwable](b.uPickle()) intercept[Throwable](b.zioJson()) + //FIXME: zio-schema-json parses only 127 levels of nesting instead of 128 + //intercept[Throwable](b.zioSchemaJson()) } } } \ No newline at end of file diff --git a/jsoniter-scala-benchmark/js/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/NestedStructsWritingSpec.scala b/jsoniter-scala-benchmark/js/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/NestedStructsWritingSpec.scala index 62232f4b0..eb7c98181 100644 --- a/jsoniter-scala-benchmark/js/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/NestedStructsWritingSpec.scala +++ b/jsoniter-scala-benchmark/js/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/NestedStructsWritingSpec.scala @@ -19,6 +19,7 @@ class NestedStructsWritingSpec extends BenchmarkSpecBase { toString(b.smithy4sJson()) shouldBe b.jsonString toString(b.uPickle()) shouldBe b.jsonString toString(b.zioJson()) shouldBe b.jsonString + toString(b.zioSchemaJson()) shouldBe b.jsonString } } } \ No newline at end of file diff --git a/jsoniter-scala-benchmark/js/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/OpenRTBReadingSpec.scala b/jsoniter-scala-benchmark/js/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/OpenRTBReadingSpec.scala index 58c620c8e..b8a5ee367 100644 --- a/jsoniter-scala-benchmark/js/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/OpenRTBReadingSpec.scala +++ b/jsoniter-scala-benchmark/js/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/OpenRTBReadingSpec.scala @@ -18,6 +18,7 @@ class OpenRTBReadingSpec extends BenchmarkSpecBase { benchmark.smithy4sJson() shouldBe benchmark.obj benchmark.uPickle() shouldBe benchmark.obj benchmark.zioJson() shouldBe benchmark.obj + benchmark.zioSchemaJson() shouldBe benchmark.obj } "fail on invalid input" in { val b = benchmark @@ -31,6 +32,7 @@ class OpenRTBReadingSpec extends BenchmarkSpecBase { intercept[Throwable](b.smithy4sJson()) intercept[Throwable](b.uPickle()) intercept[Throwable](b.zioJson()) + intercept[Throwable](b.zioSchemaJson()) } } } \ No newline at end of file diff --git a/jsoniter-scala-benchmark/js/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/OpenRTBWritingSpec.scala b/jsoniter-scala-benchmark/js/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/OpenRTBWritingSpec.scala index 094dfdb48..a12c4e45a 100644 --- a/jsoniter-scala-benchmark/js/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/OpenRTBWritingSpec.scala +++ b/jsoniter-scala-benchmark/js/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/OpenRTBWritingSpec.scala @@ -17,8 +17,10 @@ class OpenRTBWritingSpec extends BenchmarkSpecBase { toString(b.playJsonJsoniter()) shouldBe b.jsonString1 toString(b.smithy4sJson()) shouldBe b.jsonString1 toString(b.uPickle()) shouldBe b.jsonString1 - //FIXME: Zio-JSON serializes empty collections + //FIXME: zio-json serializes empty collections //toString(b.zioJson()) shouldBe b.jsonString1 + //FIXME: zio-schema-json serializes default values + //toString(b.zioSchemaJson()) shouldBe b.jsonString1 } } } \ No newline at end of file diff --git a/jsoniter-scala-benchmark/js/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/PrimitivesReadingSpec.scala b/jsoniter-scala-benchmark/js/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/PrimitivesReadingSpec.scala index 8342fde19..b550b6dcb 100644 --- a/jsoniter-scala-benchmark/js/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/PrimitivesReadingSpec.scala +++ b/jsoniter-scala-benchmark/js/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/PrimitivesReadingSpec.scala @@ -18,6 +18,7 @@ class PrimitivesReadingSpec extends BenchmarkSpecBase { benchmark.smithy4sJson() shouldBe benchmark.obj benchmark.uPickle() shouldBe benchmark.obj benchmark.zioJson() shouldBe benchmark.obj + benchmark.zioSchemaJson() shouldBe benchmark.obj } "fail on invalid input" in { val b = benchmark @@ -31,6 +32,7 @@ class PrimitivesReadingSpec extends BenchmarkSpecBase { intercept[Throwable](b.smithy4sJson()) intercept[Throwable](b.uPickle()) intercept[Throwable](b.zioJson()) + intercept[Throwable](b.zioSchemaJson()) } } } \ No newline at end of file diff --git a/jsoniter-scala-benchmark/js/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/PrimitivesWritingSpec.scala b/jsoniter-scala-benchmark/js/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/PrimitivesWritingSpec.scala index e19156f5a..d7c7b3182 100644 --- a/jsoniter-scala-benchmark/js/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/PrimitivesWritingSpec.scala +++ b/jsoniter-scala-benchmark/js/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/PrimitivesWritingSpec.scala @@ -18,6 +18,7 @@ class PrimitivesWritingSpec extends BenchmarkSpecBase { toString(b.smithy4sJson()) shouldBe b.jsonString1 toString(b.uPickle()) shouldBe b.jsonString3 toString(b.zioJson()) shouldBe b.jsonString1 + toString(b.zioSchemaJson()) shouldBe b.jsonString1 } } } \ No newline at end of file diff --git a/jsoniter-scala-benchmark/js/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/TwitterAPIReadingSpec.scala b/jsoniter-scala-benchmark/js/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/TwitterAPIReadingSpec.scala index 7ce6ae20b..2b8f572f1 100644 --- a/jsoniter-scala-benchmark/js/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/TwitterAPIReadingSpec.scala +++ b/jsoniter-scala-benchmark/js/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/TwitterAPIReadingSpec.scala @@ -19,6 +19,7 @@ class TwitterAPIReadingSpec extends BenchmarkSpecBase { benchmark.smithy4sJson() shouldBe benchmark.obj benchmark.uPickle() shouldBe benchmark.obj benchmark.zioJson() shouldBe benchmark.obj + benchmark.zioSchemaJson() shouldBe benchmark.obj } "fail on invalid input" in { val b = benchmark @@ -32,6 +33,7 @@ class TwitterAPIReadingSpec extends BenchmarkSpecBase { intercept[Throwable](b.smithy4sJson()) intercept[Throwable](b.uPickle()) intercept[Throwable](b.zioJson()) + intercept[Throwable](b.zioSchemaJson()) } } } \ No newline at end of file diff --git a/jsoniter-scala-benchmark/js/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/TwitterAPIWritingSpec.scala b/jsoniter-scala-benchmark/js/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/TwitterAPIWritingSpec.scala index 2e5c57db2..8669be9eb 100644 --- a/jsoniter-scala-benchmark/js/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/TwitterAPIWritingSpec.scala +++ b/jsoniter-scala-benchmark/js/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/TwitterAPIWritingSpec.scala @@ -17,8 +17,9 @@ class TwitterAPIWritingSpec extends BenchmarkSpecBase { toString(b.playJsonJsoniter()) shouldBe b.compactJsonString1 toString(b.smithy4sJson()) shouldBe b.compactJsonString1 toString(b.uPickle()) shouldBe b.compactJsonString1 - //FIXME: Zio-JSON serializes empty collections - //toString(b.zioJson()) shouldBe b.compactJsonString + //FIXME: zio-json serializes empty collections + //toString(b.zioJson()) shouldBe b.compactJsonString1 + toString(b.zioSchemaJson()) shouldBe b.compactJsonString1 } } } \ No newline at end of file diff --git a/jsoniter-scala-benchmark/jvm/src/test/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ADTReadingSpec.scala b/jsoniter-scala-benchmark/jvm/src/test/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ADTReadingSpec.scala index e63fb258a..5018677de 100644 --- a/jsoniter-scala-benchmark/jvm/src/test/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ADTReadingSpec.scala +++ b/jsoniter-scala-benchmark/jvm/src/test/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ADTReadingSpec.scala @@ -24,6 +24,8 @@ class ADTReadingSpec extends BenchmarkSpecBase { benchmark.uPickle() shouldBe benchmark.obj benchmark.weePickle() shouldBe benchmark.obj benchmark.zioJson() shouldBe benchmark.obj + //FIXME: zio-schema-json throws java.lang.RuntimeException: .type.Z.l.type(unrecognized subtype) + //benchmark.zioSchemaJson() shouldBe benchmark.obj } "fail on invalid input" in { val b = benchmark @@ -43,6 +45,8 @@ class ADTReadingSpec extends BenchmarkSpecBase { intercept[Throwable](b.uPickle()) intercept[Throwable](b.weePickle()) intercept[Throwable](b.zioJson()) + //FIXME: zio-schema-json throws java.lang.RuntimeException: .type.Z.l.type(unrecognized subtype) + //intercept[Throwable](b.zioSchemaJson()) } "fail on invalid discriminator value" in { val b = benchmark diff --git a/jsoniter-scala-benchmark/jvm/src/test/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ADTWritingSpec.scala b/jsoniter-scala-benchmark/jvm/src/test/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ADTWritingSpec.scala index 5eb066596..446fdcb5e 100644 --- a/jsoniter-scala-benchmark/jvm/src/test/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ADTWritingSpec.scala +++ b/jsoniter-scala-benchmark/jvm/src/test/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ADTWritingSpec.scala @@ -24,6 +24,8 @@ class ADTWritingSpec extends BenchmarkSpecBase { toString(b.uPickle()) shouldBe b.jsonString1 toString(b.weePickle()) shouldBe b.jsonString1 toString(b.zioJson()) shouldBe b.jsonString1 + //FIXME: zio-schema-json doesn't serialize the discriminator field + //toString(b.zioSchemaJson()) shouldBe b.jsonString1 } "fail on invalid input" in { val b = benchmark diff --git a/jsoniter-scala-benchmark/jvm/src/test/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/AnyValsReadingSpec.scala b/jsoniter-scala-benchmark/jvm/src/test/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/AnyValsReadingSpec.scala index 8e4daff1c..baa003e4a 100644 --- a/jsoniter-scala-benchmark/jvm/src/test/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/AnyValsReadingSpec.scala +++ b/jsoniter-scala-benchmark/jvm/src/test/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/AnyValsReadingSpec.scala @@ -26,6 +26,7 @@ class AnyValsReadingSpec extends BenchmarkSpecBase { benchmark.uPickle() shouldBe benchmark.obj benchmark.weePickle() shouldBe benchmark.obj benchmark.zioJson() shouldBe benchmark.obj + benchmark.zioSchemaJson() shouldBe benchmark.obj } "fail on invalid input" in { val b = benchmark @@ -45,6 +46,7 @@ class AnyValsReadingSpec extends BenchmarkSpecBase { intercept[Throwable](b.uPickle()) intercept[Throwable](b.weePickle()) intercept[Throwable](b.zioJson()) + intercept[Throwable](b.zioSchemaJson()) } } } \ No newline at end of file diff --git a/jsoniter-scala-benchmark/jvm/src/test/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/AnyValsWritingSpec.scala b/jsoniter-scala-benchmark/jvm/src/test/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/AnyValsWritingSpec.scala index ef0618848..2dc829f50 100644 --- a/jsoniter-scala-benchmark/jvm/src/test/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/AnyValsWritingSpec.scala +++ b/jsoniter-scala-benchmark/jvm/src/test/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/AnyValsWritingSpec.scala @@ -26,6 +26,7 @@ class AnyValsWritingSpec extends BenchmarkSpecBase { toString(b.uPickle()) shouldBe b.jsonString3 toString(b.weePickle()) shouldBe b.jsonString1 toString(b.zioJson()) shouldBe b.jsonString1 + toString(b.zioSchemaJson()) shouldBe b.jsonString1 } } } \ No newline at end of file diff --git a/jsoniter-scala-benchmark/jvm/src/test/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ExtractFieldsReadingSpec.scala b/jsoniter-scala-benchmark/jvm/src/test/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ExtractFieldsReadingSpec.scala index cfb519b49..5a590a282 100644 --- a/jsoniter-scala-benchmark/jvm/src/test/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ExtractFieldsReadingSpec.scala +++ b/jsoniter-scala-benchmark/jvm/src/test/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ExtractFieldsReadingSpec.scala @@ -25,6 +25,7 @@ class ExtractFieldsReadingSpec extends BenchmarkSpecBase { benchmark.uPickle() shouldBe benchmark.obj benchmark.weePickle() shouldBe benchmark.obj benchmark.zioJson() shouldBe benchmark.obj + benchmark.zioSchemaJson() shouldBe benchmark.obj } "fail on invalid input" in { val b = benchmark @@ -45,6 +46,7 @@ class ExtractFieldsReadingSpec extends BenchmarkSpecBase { intercept[Throwable](b.uPickle()) intercept[Throwable](b.weePickle()) intercept[Throwable](b.zioJson()) + intercept[Throwable](b.zioSchemaJson()) } } } \ No newline at end of file diff --git a/jsoniter-scala-benchmark/jvm/src/test/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/GeoJSONReadingSpec.scala b/jsoniter-scala-benchmark/jvm/src/test/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/GeoJSONReadingSpec.scala index 8ddd84fe7..c9abe0273 100644 --- a/jsoniter-scala-benchmark/jvm/src/test/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/GeoJSONReadingSpec.scala +++ b/jsoniter-scala-benchmark/jvm/src/test/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/GeoJSONReadingSpec.scala @@ -24,6 +24,8 @@ class GeoJSONReadingSpec extends BenchmarkSpecBase { benchmark.uPickle() shouldBe benchmark.obj benchmark.weePickle() shouldBe benchmark.obj benchmark.zioJson() shouldBe benchmark.obj + //FIXME: zio-schema-json throws java.lang.RuntimeException: .type.FeatureCollection.features[0].type.Feature.geometry.type.Polygon(unrecognized subtype) + //benchmark.zioSchemaJson() shouldBe benchmark.obj } "fail on invalid input" in { val b = benchmark @@ -43,6 +45,8 @@ class GeoJSONReadingSpec extends BenchmarkSpecBase { intercept[Throwable](b.uPickle()) intercept[Throwable](b.weePickle()) intercept[Throwable](b.zioJson()) + //FIXME: zio-schema-json throws java.lang.RuntimeException: .type.FeatureCollection.features[0].type.Feature.geometry.type.Polygon(unrecognized subtype) + //intercept[Throwable](b.zioSchemaJson()) } } } \ No newline at end of file diff --git a/jsoniter-scala-benchmark/jvm/src/test/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/GeoJSONWritingSpec.scala b/jsoniter-scala-benchmark/jvm/src/test/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/GeoJSONWritingSpec.scala index 570876932..5edb2da59 100644 --- a/jsoniter-scala-benchmark/jvm/src/test/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/GeoJSONWritingSpec.scala +++ b/jsoniter-scala-benchmark/jvm/src/test/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/GeoJSONWritingSpec.scala @@ -24,6 +24,7 @@ class GeoJSONWritingSpec extends BenchmarkSpecBase { toString(b.uPickle()) shouldBe b.jsonString1 toString(b.weePickle()) shouldBe b.jsonString1 toString(b.zioJson()) shouldBe b.jsonString1 + toString(b.zioSchemaJson()) shouldBe b.jsonString1 } } } \ No newline at end of file diff --git a/jsoniter-scala-benchmark/jvm/src/test/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/GitHubActionsAPIReadingSpec.scala b/jsoniter-scala-benchmark/jvm/src/test/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/GitHubActionsAPIReadingSpec.scala index 63b1f5ee5..06f8f7ad5 100644 --- a/jsoniter-scala-benchmark/jvm/src/test/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/GitHubActionsAPIReadingSpec.scala +++ b/jsoniter-scala-benchmark/jvm/src/test/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/GitHubActionsAPIReadingSpec.scala @@ -24,6 +24,7 @@ class GitHubActionsAPIReadingSpec extends BenchmarkSpecBase { benchmark.uPickle() shouldBe benchmark.obj benchmark.weePickle() shouldBe benchmark.obj benchmark.zioJson() shouldBe benchmark.obj + benchmark.zioSchemaJson() shouldBe benchmark.obj } "fail on invalid input" in { val b = benchmark @@ -43,6 +44,7 @@ class GitHubActionsAPIReadingSpec extends BenchmarkSpecBase { intercept[Throwable](b.uPickle()) intercept[Throwable](b.weePickle()) intercept[Throwable](b.zioJson()) + intercept[Throwable](b.zioSchemaJson()) } } } \ No newline at end of file diff --git a/jsoniter-scala-benchmark/jvm/src/test/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/GitHubActionsAPIWritingSpec.scala b/jsoniter-scala-benchmark/jvm/src/test/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/GitHubActionsAPIWritingSpec.scala index 71b6cf2ac..d319370a8 100644 --- a/jsoniter-scala-benchmark/jvm/src/test/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/GitHubActionsAPIWritingSpec.scala +++ b/jsoniter-scala-benchmark/jvm/src/test/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/GitHubActionsAPIWritingSpec.scala @@ -24,6 +24,7 @@ class GitHubActionsAPIWritingSpec extends BenchmarkSpecBase { toString(b.uPickle()) shouldBe b.compactJsonString1 toString(b.weePickle()) shouldBe b.compactJsonString1 toString(b.zioJson()) shouldBe b.compactJsonString1 + toString(b.zioSchemaJson()) shouldBe b.compactJsonString1 } } } \ No newline at end of file diff --git a/jsoniter-scala-benchmark/jvm/src/test/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/GoogleMapsAPIPrettyPrintingSpec.scala b/jsoniter-scala-benchmark/jvm/src/test/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/GoogleMapsAPIPrettyPrintingSpec.scala index b369f75b1..2f429e525 100644 --- a/jsoniter-scala-benchmark/jvm/src/test/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/GoogleMapsAPIPrettyPrintingSpec.scala +++ b/jsoniter-scala-benchmark/jvm/src/test/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/GoogleMapsAPIPrettyPrintingSpec.scala @@ -23,6 +23,7 @@ class GoogleMapsAPIPrettyPrintingSpec extends BenchmarkSpecBase { toString(b.uPickle()) shouldBe b.jsonString2 toString(b.weePickle()) shouldBe b.jsonString2 toString(b.zioJson()) shouldBe b.jsonString1 + toString(b.zioSchemaJson()) shouldBe b.jsonString1 } } } \ No newline at end of file diff --git a/jsoniter-scala-benchmark/jvm/src/test/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/GoogleMapsAPIReadingSpec.scala b/jsoniter-scala-benchmark/jvm/src/test/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/GoogleMapsAPIReadingSpec.scala index 3d6de84e8..c79066786 100644 --- a/jsoniter-scala-benchmark/jvm/src/test/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/GoogleMapsAPIReadingSpec.scala +++ b/jsoniter-scala-benchmark/jvm/src/test/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/GoogleMapsAPIReadingSpec.scala @@ -25,6 +25,7 @@ class GoogleMapsAPIReadingSpec extends BenchmarkSpecBase { benchmark.uPickle() shouldBe benchmark.obj benchmark.weePickle() shouldBe benchmark.obj benchmark.zioJson() shouldBe benchmark.obj + benchmark.zioSchemaJson() shouldBe benchmark.obj } "fail on invalid input" in { val b = benchmark @@ -45,6 +46,7 @@ class GoogleMapsAPIReadingSpec extends BenchmarkSpecBase { intercept[Throwable](b.uPickle()) intercept[Throwable](b.weePickle()) intercept[Throwable](b.zioJson()) + intercept[Throwable](b.zioSchemaJson()) } } } \ No newline at end of file diff --git a/jsoniter-scala-benchmark/jvm/src/test/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/GoogleMapsAPIWritingSpec.scala b/jsoniter-scala-benchmark/jvm/src/test/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/GoogleMapsAPIWritingSpec.scala index 940a701c4..7fffca8a2 100644 --- a/jsoniter-scala-benchmark/jvm/src/test/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/GoogleMapsAPIWritingSpec.scala +++ b/jsoniter-scala-benchmark/jvm/src/test/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/GoogleMapsAPIWritingSpec.scala @@ -25,6 +25,7 @@ class GoogleMapsAPIWritingSpec extends BenchmarkSpecBase { toString(b.uPickle()) shouldBe b.compactJsonString1 toString(b.weePickle()) shouldBe b.compactJsonString1 toString(b.zioJson()) shouldBe b.compactJsonString1 + toString(b.zioSchemaJson()) shouldBe b.compactJsonString1 } } } \ No newline at end of file diff --git a/jsoniter-scala-benchmark/jvm/src/test/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/MissingRequiredFieldsReadingSpec.scala b/jsoniter-scala-benchmark/jvm/src/test/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/MissingRequiredFieldsReadingSpec.scala index 92c1f4a8a..e7f46baa5 100644 --- a/jsoniter-scala-benchmark/jvm/src/test/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/MissingRequiredFieldsReadingSpec.scala +++ b/jsoniter-scala-benchmark/jvm/src/test/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/MissingRequiredFieldsReadingSpec.scala @@ -49,6 +49,7 @@ class MissingRequiredFieldsReadingSpec extends BenchmarkSpecBase { b.uPickle() shouldBe "missing keys in dictionary: s, i at index 1" b.weePickle() shouldBe "Parser or Visitor failure jsonPointer= index=2 line=1 col=3 token=END_OBJECT" b.zioJson() shouldBe ".s(missing)" + b.zioSchemaJson() shouldBe ".s(missing)" } "return toString value for valid input" in { val b = benchmark @@ -71,6 +72,7 @@ class MissingRequiredFieldsReadingSpec extends BenchmarkSpecBase { b.uPickle() shouldBe "MissingRequiredFields(VVV,1)" b.weePickle() shouldBe "MissingRequiredFields(VVV,1)" b.zioJson() shouldBe "MissingRequiredFields(VVV,1)" + b.zioSchemaJson() shouldBe "MissingRequiredFields(VVV,1)" } } } \ No newline at end of file diff --git a/jsoniter-scala-benchmark/jvm/src/test/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/NestedStructsReadingSpec.scala b/jsoniter-scala-benchmark/jvm/src/test/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/NestedStructsReadingSpec.scala index a76b04f35..127f5247b 100644 --- a/jsoniter-scala-benchmark/jvm/src/test/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/NestedStructsReadingSpec.scala +++ b/jsoniter-scala-benchmark/jvm/src/test/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/NestedStructsReadingSpec.scala @@ -26,6 +26,8 @@ class NestedStructsReadingSpec extends BenchmarkSpecBase { benchmark.uPickle() shouldBe benchmark.obj benchmark.weePickle() shouldBe benchmark.obj benchmark.zioJson() shouldBe benchmark.obj + //FIXME: zio-schema-json parses only 127 levels of nesting instead of 128 + //benchmark.zioSchemaJson() shouldBe benchmark.obj } "fail on invalid input" in { val b = benchmark @@ -46,6 +48,8 @@ class NestedStructsReadingSpec extends BenchmarkSpecBase { intercept[Throwable](b.uPickle()) intercept[Throwable](b.weePickle()) intercept[Throwable](b.zioJson()) + //FIXME: zio-schema-json parses only 127 levels of nesting instead of 128 + //intercept[Throwable](b.zioSchemaJson()) } } } \ No newline at end of file diff --git a/jsoniter-scala-benchmark/jvm/src/test/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/NestedStructsWritingSpec.scala b/jsoniter-scala-benchmark/jvm/src/test/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/NestedStructsWritingSpec.scala index 92d2d6cc4..8cf5f0c32 100644 --- a/jsoniter-scala-benchmark/jvm/src/test/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/NestedStructsWritingSpec.scala +++ b/jsoniter-scala-benchmark/jvm/src/test/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/NestedStructsWritingSpec.scala @@ -27,6 +27,7 @@ class NestedStructsWritingSpec extends BenchmarkSpecBase { toString(b.uPickle()) shouldBe b.jsonString toString(b.weePickle()) shouldBe b.jsonString toString(b.zioJson()) shouldBe b.jsonString + toString(b.zioSchemaJson()) shouldBe b.jsonString } } } \ No newline at end of file diff --git a/jsoniter-scala-benchmark/jvm/src/test/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/OpenRTBReadingSpec.scala b/jsoniter-scala-benchmark/jvm/src/test/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/OpenRTBReadingSpec.scala index c33cd8015..2bcba0703 100644 --- a/jsoniter-scala-benchmark/jvm/src/test/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/OpenRTBReadingSpec.scala +++ b/jsoniter-scala-benchmark/jvm/src/test/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/OpenRTBReadingSpec.scala @@ -24,6 +24,7 @@ class OpenRTBReadingSpec extends BenchmarkSpecBase { benchmark.uPickle() shouldBe benchmark.obj benchmark.weePickle() shouldBe benchmark.obj benchmark.zioJson() shouldBe benchmark.obj + benchmark.zioSchemaJson() shouldBe benchmark.obj } "fail on invalid input" in { val b = benchmark @@ -43,6 +44,7 @@ class OpenRTBReadingSpec extends BenchmarkSpecBase { intercept[Throwable](b.uPickle()) intercept[Throwable](b.weePickle()) intercept[Throwable](b.zioJson()) + intercept[Throwable](b.zioSchemaJson()) } } } \ No newline at end of file diff --git a/jsoniter-scala-benchmark/jvm/src/test/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/OpenRTBWritingSpec.scala b/jsoniter-scala-benchmark/jvm/src/test/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/OpenRTBWritingSpec.scala index cc6d0e1a5..c8d2697fb 100644 --- a/jsoniter-scala-benchmark/jvm/src/test/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/OpenRTBWritingSpec.scala +++ b/jsoniter-scala-benchmark/jvm/src/test/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/OpenRTBWritingSpec.scala @@ -26,8 +26,10 @@ class OpenRTBWritingSpec extends BenchmarkSpecBase { toString(b.sprayJson()) shouldBe b.jsonString2 toString(b.uPickle()) shouldBe b.jsonString1 toString(b.weePickle()) shouldBe b.jsonString1 - //FIXME: Zio-JSON serializes empty collections + //FIXME: zio-json serializes empty collections //toString(b.zioJson()) shouldBe b.jsonString1 + //FIXME: zio-schema-json serializes default values + //toString(b.zioSchemaJson()) shouldBe b.jsonString1 } } } \ No newline at end of file diff --git a/jsoniter-scala-benchmark/jvm/src/test/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/PrimitivesReadingSpec.scala b/jsoniter-scala-benchmark/jvm/src/test/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/PrimitivesReadingSpec.scala index e7834beba..4874d84c1 100644 --- a/jsoniter-scala-benchmark/jvm/src/test/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/PrimitivesReadingSpec.scala +++ b/jsoniter-scala-benchmark/jvm/src/test/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/PrimitivesReadingSpec.scala @@ -25,6 +25,7 @@ class PrimitivesReadingSpec extends BenchmarkSpecBase { benchmark.uPickle() shouldBe benchmark.obj benchmark.weePickle() shouldBe benchmark.obj benchmark.zioJson() shouldBe benchmark.obj + benchmark.zioSchemaJson() shouldBe benchmark.obj } "fail on invalid input" in { val b = benchmark @@ -45,6 +46,7 @@ class PrimitivesReadingSpec extends BenchmarkSpecBase { intercept[Throwable](b.uPickle()) intercept[Throwable](b.weePickle()) intercept[Throwable](b.zioJson()) + intercept[Throwable](b.zioSchemaJson()) } } } \ No newline at end of file diff --git a/jsoniter-scala-benchmark/jvm/src/test/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/PrimitivesWritingSpec.scala b/jsoniter-scala-benchmark/jvm/src/test/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/PrimitivesWritingSpec.scala index fc87c7a2a..1d2f8234c 100644 --- a/jsoniter-scala-benchmark/jvm/src/test/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/PrimitivesWritingSpec.scala +++ b/jsoniter-scala-benchmark/jvm/src/test/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/PrimitivesWritingSpec.scala @@ -25,6 +25,7 @@ class PrimitivesWritingSpec extends BenchmarkSpecBase { toString(b.uPickle()) shouldBe b.jsonString3 toString(b.weePickle()) shouldBe b.jsonString1 toString(b.zioJson()) shouldBe b.jsonString1 + toString(b.zioSchemaJson()) shouldBe b.jsonString1 } } } \ No newline at end of file diff --git a/jsoniter-scala-benchmark/jvm/src/test/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/TwitterAPIReadingSpec.scala b/jsoniter-scala-benchmark/jvm/src/test/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/TwitterAPIReadingSpec.scala index d1011b33f..e153fd2c0 100644 --- a/jsoniter-scala-benchmark/jvm/src/test/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/TwitterAPIReadingSpec.scala +++ b/jsoniter-scala-benchmark/jvm/src/test/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/TwitterAPIReadingSpec.scala @@ -25,6 +25,7 @@ class TwitterAPIReadingSpec extends BenchmarkSpecBase { benchmark.uPickle() shouldBe benchmark.obj benchmark.weePickle() shouldBe benchmark.obj benchmark.zioJson() shouldBe benchmark.obj + benchmark.zioSchemaJson() shouldBe benchmark.obj } "fail on invalid input" in { val b = benchmark @@ -45,6 +46,7 @@ class TwitterAPIReadingSpec extends BenchmarkSpecBase { intercept[Throwable](b.uPickle()) intercept[Throwable](b.weePickle()) intercept[Throwable](b.zioJson()) + intercept[Throwable](b.zioSchemaJson()) } } } \ No newline at end of file diff --git a/jsoniter-scala-benchmark/jvm/src/test/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/TwitterAPIWritingSpec.scala b/jsoniter-scala-benchmark/jvm/src/test/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/TwitterAPIWritingSpec.scala index af6519da2..7c73e758e 100644 --- a/jsoniter-scala-benchmark/jvm/src/test/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/TwitterAPIWritingSpec.scala +++ b/jsoniter-scala-benchmark/jvm/src/test/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/TwitterAPIWritingSpec.scala @@ -27,8 +27,9 @@ class TwitterAPIWritingSpec extends BenchmarkSpecBase { toString(b.sprayJson()) shouldBe b.compactJsonString2 toString(b.uPickle()) shouldBe b.compactJsonString1 toString(b.weePickle()) shouldBe b.compactJsonString1 - //FIXME: Zio-JSON serializes empty collections + //FIXME: zio-json serializes empty collections //toString(b.zioJson()) shouldBe b.compactJsonString1 + toString(b.zioSchemaJson()) shouldBe b.compactJsonString1 } } } \ No newline at end of file diff --git a/jsoniter-scala-benchmark/jvm/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ADTReadingSpec.scala b/jsoniter-scala-benchmark/jvm/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ADTReadingSpec.scala index 44e39ad67..17d594b6c 100644 --- a/jsoniter-scala-benchmark/jvm/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ADTReadingSpec.scala +++ b/jsoniter-scala-benchmark/jvm/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ADTReadingSpec.scala @@ -23,6 +23,8 @@ class ADTReadingSpec extends BenchmarkSpecBase { benchmark.uPickle() shouldBe benchmark.obj benchmark.weePickle() shouldBe benchmark.obj benchmark.zioJson() shouldBe benchmark.obj + //FIXME: zio-schema-json throws java.lang.RuntimeException: .type.Z.l.type(unrecognized subtype) + //benchmark.zioSchemaJson() shouldBe benchmark.obj } "fail on invalid input" in { val b = benchmark @@ -41,6 +43,8 @@ class ADTReadingSpec extends BenchmarkSpecBase { intercept[Throwable](b.uPickle()) intercept[Throwable](b.weePickle()) intercept[Throwable](b.zioJson()) + //FIXME: zio-schema-json throws java.lang.RuntimeException: .type.Z.l.type(unrecognized subtype) + //intercept[Throwable](b.zioSchemaJson()) } "fail on invalid discriminator value" in { val b = benchmark diff --git a/jsoniter-scala-benchmark/jvm/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ADTWritingSpec.scala b/jsoniter-scala-benchmark/jvm/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ADTWritingSpec.scala index bd613f6c6..c361eb85b 100644 --- a/jsoniter-scala-benchmark/jvm/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ADTWritingSpec.scala +++ b/jsoniter-scala-benchmark/jvm/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ADTWritingSpec.scala @@ -23,6 +23,8 @@ class ADTWritingSpec extends BenchmarkSpecBase { toString(b.uPickle()) shouldBe b.jsonString1 toString(b.weePickle()) shouldBe b.jsonString1 toString(b.zioJson()) shouldBe b.jsonString1 + //FIXME: zio-schema-json doesn't serialize the discriminator field + //toString(b.zioSchemaJson()) shouldBe b.jsonString1 } "fail on invalid input" in { val b = benchmark diff --git a/jsoniter-scala-benchmark/jvm/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/AnyValsReadingSpec.scala b/jsoniter-scala-benchmark/jvm/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/AnyValsReadingSpec.scala index 94808eef2..d28d20be4 100644 --- a/jsoniter-scala-benchmark/jvm/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/AnyValsReadingSpec.scala +++ b/jsoniter-scala-benchmark/jvm/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/AnyValsReadingSpec.scala @@ -25,6 +25,7 @@ class AnyValsReadingSpec extends BenchmarkSpecBase { benchmark.uPickle() shouldBe benchmark.obj benchmark.weePickle() shouldBe benchmark.obj benchmark.zioJson() shouldBe benchmark.obj + benchmark.zioSchemaJson() shouldBe benchmark.obj } "fail on invalid input" in { val b = benchmark @@ -43,6 +44,7 @@ class AnyValsReadingSpec extends BenchmarkSpecBase { intercept[Throwable](b.uPickle()) intercept[Throwable](b.weePickle()) intercept[Throwable](b.zioJson()) + intercept[Throwable](b.zioSchemaJson()) } } } \ No newline at end of file diff --git a/jsoniter-scala-benchmark/jvm/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/AnyValsWritingSpec.scala b/jsoniter-scala-benchmark/jvm/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/AnyValsWritingSpec.scala index 9d161c2bf..33f3049bf 100644 --- a/jsoniter-scala-benchmark/jvm/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/AnyValsWritingSpec.scala +++ b/jsoniter-scala-benchmark/jvm/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/AnyValsWritingSpec.scala @@ -25,6 +25,7 @@ class AnyValsWritingSpec extends BenchmarkSpecBase { toString(b.uPickle()) shouldBe b.jsonString3 toString(b.weePickle()) shouldBe b.jsonString1 toString(b.zioJson()) shouldBe b.jsonString1 + toString(b.zioSchemaJson()) shouldBe b.jsonString1 } } } \ No newline at end of file diff --git a/jsoniter-scala-benchmark/jvm/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ExtractFieldsReadingSpec.scala b/jsoniter-scala-benchmark/jvm/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ExtractFieldsReadingSpec.scala index 3dce62bf3..2dbe26b25 100644 --- a/jsoniter-scala-benchmark/jvm/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ExtractFieldsReadingSpec.scala +++ b/jsoniter-scala-benchmark/jvm/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ExtractFieldsReadingSpec.scala @@ -23,6 +23,7 @@ class ExtractFieldsReadingSpec extends BenchmarkSpecBase { benchmark.uPickle() shouldBe benchmark.obj benchmark.weePickle() shouldBe benchmark.obj benchmark.zioJson() shouldBe benchmark.obj + benchmark.zioSchemaJson() shouldBe benchmark.obj } "fail on invalid input" in { val b = benchmark @@ -41,6 +42,7 @@ class ExtractFieldsReadingSpec extends BenchmarkSpecBase { intercept[Throwable](b.uPickle()) intercept[Throwable](b.weePickle()) intercept[Throwable](b.zioJson()) + intercept[Throwable](b.zioSchemaJson()) } } } \ No newline at end of file diff --git a/jsoniter-scala-benchmark/jvm/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/GeoJSONReadingSpec.scala b/jsoniter-scala-benchmark/jvm/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/GeoJSONReadingSpec.scala index a464cb92e..98dce716c 100644 --- a/jsoniter-scala-benchmark/jvm/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/GeoJSONReadingSpec.scala +++ b/jsoniter-scala-benchmark/jvm/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/GeoJSONReadingSpec.scala @@ -25,6 +25,8 @@ class GeoJSONReadingSpec extends BenchmarkSpecBase { benchmark.uPickle() shouldBe benchmark.obj benchmark.weePickle() shouldBe benchmark.obj benchmark.zioJson() shouldBe benchmark.obj + //FIXME: zio-schema-json throws java.lang.RuntimeException: .type.FeatureCollection.features[0].type.Feature.geometry.type.Polygon(unrecognized subtype) + //benchmark.zioSchemaJson() shouldBe benchmark.obj } "fail on invalid input" in { val b = benchmark @@ -45,6 +47,8 @@ class GeoJSONReadingSpec extends BenchmarkSpecBase { intercept[Throwable](b.uPickle()) intercept[Throwable](b.weePickle()) intercept[Throwable](b.zioJson()) + //FIXME: zio-schema-json throws java.lang.RuntimeException: .type.FeatureCollection.features[0].type.Feature.geometry.type.Polygon(unrecognized subtype) + //intercept[Throwable](b.zioSchemaJson()) } } } \ No newline at end of file diff --git a/jsoniter-scala-benchmark/jvm/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/GeoJSONWritingSpec.scala b/jsoniter-scala-benchmark/jvm/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/GeoJSONWritingSpec.scala index e917baae2..c4127f0a0 100644 --- a/jsoniter-scala-benchmark/jvm/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/GeoJSONWritingSpec.scala +++ b/jsoniter-scala-benchmark/jvm/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/GeoJSONWritingSpec.scala @@ -25,6 +25,7 @@ class GeoJSONWritingSpec extends BenchmarkSpecBase { toString(b.uPickle()) shouldBe b.jsonString1 toString(b.weePickle()) shouldBe b.jsonString1 toString(b.zioJson()) shouldBe b.jsonString1 + toString(b.zioSchemaJson()) shouldBe b.jsonString1 } } } \ No newline at end of file diff --git a/jsoniter-scala-benchmark/jvm/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/GitHubActionsAPIReadingSpec.scala b/jsoniter-scala-benchmark/jvm/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/GitHubActionsAPIReadingSpec.scala index 2c5805ddd..44e483d4e 100644 --- a/jsoniter-scala-benchmark/jvm/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/GitHubActionsAPIReadingSpec.scala +++ b/jsoniter-scala-benchmark/jvm/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/GitHubActionsAPIReadingSpec.scala @@ -23,6 +23,7 @@ class GitHubActionsAPIReadingSpec extends BenchmarkSpecBase { benchmark.uPickle() shouldBe benchmark.obj benchmark.weePickle() shouldBe benchmark.obj benchmark.zioJson() shouldBe benchmark.obj + benchmark.zioSchemaJson() shouldBe benchmark.obj } "fail on invalid input" in { val b = benchmark @@ -41,6 +42,7 @@ class GitHubActionsAPIReadingSpec extends BenchmarkSpecBase { intercept[Throwable](b.uPickle()) intercept[Throwable](b.weePickle()) intercept[Throwable](b.zioJson()) + intercept[Throwable](b.zioSchemaJson()) } } } \ No newline at end of file diff --git a/jsoniter-scala-benchmark/jvm/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/GitHubActionsAPIWritingSpec.scala b/jsoniter-scala-benchmark/jvm/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/GitHubActionsAPIWritingSpec.scala index 39c231b81..5bb43e41e 100644 --- a/jsoniter-scala-benchmark/jvm/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/GitHubActionsAPIWritingSpec.scala +++ b/jsoniter-scala-benchmark/jvm/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/GitHubActionsAPIWritingSpec.scala @@ -23,6 +23,7 @@ class GitHubActionsAPIWritingSpec extends BenchmarkSpecBase { toString(b.uPickle()) shouldBe b.compactJsonString1 toString(b.weePickle()) shouldBe b.compactJsonString1 toString(b.zioJson()) shouldBe b.compactJsonString1 + toString(b.zioSchemaJson()) shouldBe b.compactJsonString1 } } } \ No newline at end of file diff --git a/jsoniter-scala-benchmark/jvm/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/GoogleMapsAPIPrettyPrintingSpec.scala b/jsoniter-scala-benchmark/jvm/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/GoogleMapsAPIPrettyPrintingSpec.scala index 778467cd7..4d51fbca4 100644 --- a/jsoniter-scala-benchmark/jvm/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/GoogleMapsAPIPrettyPrintingSpec.scala +++ b/jsoniter-scala-benchmark/jvm/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/GoogleMapsAPIPrettyPrintingSpec.scala @@ -23,6 +23,7 @@ class GoogleMapsAPIPrettyPrintingSpec extends BenchmarkSpecBase { toString(b.uPickle()) shouldBe b.jsonString2 toString(b.weePickle()) shouldBe b.jsonString2 toString(b.zioJson()) shouldBe b.jsonString1 + toString(b.zioSchemaJson()) shouldBe b.jsonString1 } } } \ No newline at end of file diff --git a/jsoniter-scala-benchmark/jvm/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/GoogleMapsAPIReadingSpec.scala b/jsoniter-scala-benchmark/jvm/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/GoogleMapsAPIReadingSpec.scala index 8f415a28f..187300a20 100644 --- a/jsoniter-scala-benchmark/jvm/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/GoogleMapsAPIReadingSpec.scala +++ b/jsoniter-scala-benchmark/jvm/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/GoogleMapsAPIReadingSpec.scala @@ -23,6 +23,7 @@ class GoogleMapsAPIReadingSpec extends BenchmarkSpecBase { benchmark.uPickle() shouldBe benchmark.obj benchmark.weePickle() shouldBe benchmark.obj benchmark.zioJson() shouldBe benchmark.obj + benchmark.zioSchemaJson() shouldBe benchmark.obj } "fail on invalid input" in { val b = benchmark @@ -41,6 +42,7 @@ class GoogleMapsAPIReadingSpec extends BenchmarkSpecBase { intercept[Throwable](b.uPickle()) intercept[Throwable](b.weePickle()) intercept[Throwable](b.zioJson()) + intercept[Throwable](b.zioSchemaJson()) } } } \ No newline at end of file diff --git a/jsoniter-scala-benchmark/jvm/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/GoogleMapsAPIWritingSpec.scala b/jsoniter-scala-benchmark/jvm/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/GoogleMapsAPIWritingSpec.scala index afc67475b..39e4ce6f5 100644 --- a/jsoniter-scala-benchmark/jvm/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/GoogleMapsAPIWritingSpec.scala +++ b/jsoniter-scala-benchmark/jvm/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/GoogleMapsAPIWritingSpec.scala @@ -23,6 +23,7 @@ class GoogleMapsAPIWritingSpec extends BenchmarkSpecBase { toString(b.uPickle()) shouldBe b.compactJsonString1 toString(b.weePickle()) shouldBe b.compactJsonString1 toString(b.zioJson()) shouldBe b.compactJsonString1 + toString(b.zioSchemaJson()) shouldBe b.compactJsonString1 } } } \ No newline at end of file diff --git a/jsoniter-scala-benchmark/jvm/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/MissingRequiredFieldsReadingSpec.scala b/jsoniter-scala-benchmark/jvm/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/MissingRequiredFieldsReadingSpec.scala index a8e26bbda..46d81ead8 100644 --- a/jsoniter-scala-benchmark/jvm/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/MissingRequiredFieldsReadingSpec.scala +++ b/jsoniter-scala-benchmark/jvm/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/MissingRequiredFieldsReadingSpec.scala @@ -45,6 +45,7 @@ class MissingRequiredFieldsReadingSpec extends BenchmarkSpecBase { b.uPickle() shouldBe "missing keys in dictionary: s, i at index 1" b.weePickle() shouldBe "Parser or Visitor failure jsonPointer= index=2 line=1 col=3 token=END_OBJECT" b.zioJson() shouldBe ".s(missing)" + b.zioSchemaJson() shouldBe ".s(missing)" } "return toString value for valid input" in { val b = benchmark @@ -65,6 +66,7 @@ class MissingRequiredFieldsReadingSpec extends BenchmarkSpecBase { b.uPickle() shouldBe "MissingRequiredFields(VVV,1)" b.weePickle() shouldBe "MissingRequiredFields(VVV,1)" b.zioJson() shouldBe "MissingRequiredFields(VVV,1)" + b.zioSchemaJson() shouldBe "MissingRequiredFields(VVV,1)" } } } \ No newline at end of file diff --git a/jsoniter-scala-benchmark/jvm/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/NestedStructsReadingSpec.scala b/jsoniter-scala-benchmark/jvm/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/NestedStructsReadingSpec.scala index 35e075ca1..d244498e9 100644 --- a/jsoniter-scala-benchmark/jvm/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/NestedStructsReadingSpec.scala +++ b/jsoniter-scala-benchmark/jvm/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/NestedStructsReadingSpec.scala @@ -24,6 +24,8 @@ class NestedStructsReadingSpec extends BenchmarkSpecBase { benchmark.uPickle() shouldBe benchmark.obj benchmark.weePickle() shouldBe benchmark.obj benchmark.zioJson() shouldBe benchmark.obj + //FIXME: zio-schema-json parses only 127 levels of nesting instead of 128 + //benchmark.zioSchemaJson() shouldBe benchmark.obj } "fail on invalid input" in { val b = benchmark @@ -42,6 +44,8 @@ class NestedStructsReadingSpec extends BenchmarkSpecBase { intercept[Throwable](b.uPickle()) intercept[Throwable](b.weePickle()) intercept[Throwable](b.zioJson()) + //FIXME: zio-schema-json parses only 127 levels of nesting instead of 128 + //intercept[Throwable](b.zioSchemaJson()) } } } \ No newline at end of file diff --git a/jsoniter-scala-benchmark/jvm/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/NestedStructsWritingSpec.scala b/jsoniter-scala-benchmark/jvm/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/NestedStructsWritingSpec.scala index 8fb376de3..78ed6afd5 100644 --- a/jsoniter-scala-benchmark/jvm/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/NestedStructsWritingSpec.scala +++ b/jsoniter-scala-benchmark/jvm/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/NestedStructsWritingSpec.scala @@ -24,6 +24,7 @@ class NestedStructsWritingSpec extends BenchmarkSpecBase { toString(b.uPickle()) shouldBe b.jsonString toString(b.weePickle()) shouldBe b.jsonString toString(b.zioJson()) shouldBe b.jsonString + toString(b.zioSchemaJson()) shouldBe b.jsonString } } } \ No newline at end of file diff --git a/jsoniter-scala-benchmark/jvm/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/OpenRTBReadingSpec.scala b/jsoniter-scala-benchmark/jvm/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/OpenRTBReadingSpec.scala index cd4ce0de7..99990f0d4 100644 --- a/jsoniter-scala-benchmark/jvm/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/OpenRTBReadingSpec.scala +++ b/jsoniter-scala-benchmark/jvm/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/OpenRTBReadingSpec.scala @@ -25,6 +25,7 @@ class OpenRTBReadingSpec extends BenchmarkSpecBase { benchmark.uPickle() shouldBe benchmark.obj benchmark.weePickle() shouldBe benchmark.obj benchmark.zioJson() shouldBe benchmark.obj + benchmark.zioSchemaJson() shouldBe benchmark.obj } "fail on invalid input" in { val b = benchmark @@ -45,6 +46,7 @@ class OpenRTBReadingSpec extends BenchmarkSpecBase { intercept[Throwable](b.uPickle()) intercept[Throwable](b.weePickle()) intercept[Throwable](b.zioJson()) + intercept[Throwable](b.zioSchemaJson()) } } } \ No newline at end of file diff --git a/jsoniter-scala-benchmark/jvm/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/OpenRTBWritingSpec.scala b/jsoniter-scala-benchmark/jvm/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/OpenRTBWritingSpec.scala index 5cd34581e..0267f0192 100644 --- a/jsoniter-scala-benchmark/jvm/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/OpenRTBWritingSpec.scala +++ b/jsoniter-scala-benchmark/jvm/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/OpenRTBWritingSpec.scala @@ -25,8 +25,10 @@ class OpenRTBWritingSpec extends BenchmarkSpecBase { toString(b.sprayJson()) shouldBe b.jsonString2 toString(b.uPickle()) shouldBe b.jsonString1 toString(b.weePickle()) shouldBe b.jsonString1 - //FIXME: Zio-JSON serializes empty collections + //FIXME: zio-json serializes empty collections //toString(b.zioJson()) shouldBe b.jsonString1 + //FIXME: zio-schema-json serializes default values + //toString(b.zioSchemaJson()) shouldBe b.jsonString1 } } } \ No newline at end of file diff --git a/jsoniter-scala-benchmark/jvm/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/PrimitivesReadingSpec.scala b/jsoniter-scala-benchmark/jvm/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/PrimitivesReadingSpec.scala index 213407c27..0901040be 100644 --- a/jsoniter-scala-benchmark/jvm/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/PrimitivesReadingSpec.scala +++ b/jsoniter-scala-benchmark/jvm/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/PrimitivesReadingSpec.scala @@ -23,6 +23,7 @@ class PrimitivesReadingSpec extends BenchmarkSpecBase { benchmark.uPickle() shouldBe benchmark.obj benchmark.weePickle() shouldBe benchmark.obj benchmark.zioJson() shouldBe benchmark.obj + benchmark.zioSchemaJson() shouldBe benchmark.obj } "fail on invalid input" in { val b = benchmark @@ -40,7 +41,7 @@ class PrimitivesReadingSpec extends BenchmarkSpecBase { intercept[Throwable](b.sprayJson()) intercept[Throwable](b.uPickle()) intercept[Throwable](b.weePickle()) - intercept[Throwable](b.zioJson()) + intercept[Throwable](b.zioSchemaJson()) } } } \ No newline at end of file diff --git a/jsoniter-scala-benchmark/jvm/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/PrimitivesWritingSpec.scala b/jsoniter-scala-benchmark/jvm/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/PrimitivesWritingSpec.scala index 5100078e5..6b0fba135 100644 --- a/jsoniter-scala-benchmark/jvm/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/PrimitivesWritingSpec.scala +++ b/jsoniter-scala-benchmark/jvm/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/PrimitivesWritingSpec.scala @@ -23,6 +23,7 @@ class PrimitivesWritingSpec extends BenchmarkSpecBase { toString(b.uPickle()) shouldBe b.jsonString3 toString(b.weePickle()) shouldBe b.jsonString1 toString(b.zioJson()) shouldBe b.jsonString1 + toString(b.zioSchemaJson()) shouldBe b.jsonString1 } } } \ No newline at end of file diff --git a/jsoniter-scala-benchmark/jvm/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/TwitterAPIReadingSpec.scala b/jsoniter-scala-benchmark/jvm/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/TwitterAPIReadingSpec.scala index 0de0f4f87..768564774 100644 --- a/jsoniter-scala-benchmark/jvm/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/TwitterAPIReadingSpec.scala +++ b/jsoniter-scala-benchmark/jvm/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/TwitterAPIReadingSpec.scala @@ -25,6 +25,7 @@ class TwitterAPIReadingSpec extends BenchmarkSpecBase { benchmark.uPickle() shouldBe benchmark.obj benchmark.weePickle() shouldBe benchmark.obj benchmark.zioJson() shouldBe benchmark.obj + benchmark.zioSchemaJson() shouldBe benchmark.obj } "fail on invalid input" in { val b = benchmark @@ -44,7 +45,7 @@ class TwitterAPIReadingSpec extends BenchmarkSpecBase { intercept[Throwable](b.sprayJson()) intercept[Throwable](b.uPickle()) intercept[Throwable](b.weePickle()) - intercept[Throwable](b.zioJson()) + intercept[Throwable](b.zioSchemaJson()) } } } \ No newline at end of file diff --git a/jsoniter-scala-benchmark/jvm/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/TwitterAPIWritingSpec.scala b/jsoniter-scala-benchmark/jvm/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/TwitterAPIWritingSpec.scala index 9e64c3310..bf1fdcc46 100644 --- a/jsoniter-scala-benchmark/jvm/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/TwitterAPIWritingSpec.scala +++ b/jsoniter-scala-benchmark/jvm/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/TwitterAPIWritingSpec.scala @@ -24,8 +24,9 @@ class TwitterAPIWritingSpec extends BenchmarkSpecBase { toString(b.sprayJson()) shouldBe b.compactJsonString2 toString(b.uPickle()) shouldBe b.compactJsonString1 toString(b.weePickle()) shouldBe b.compactJsonString1 - //FIXME: Zio-JSON serializes empty collections + //FIXME: zio-json serializes empty collections //toString(b.zioJson()) shouldBe b.compactJsonString1 + toString(b.zioSchemaJson()) shouldBe b.compactJsonString1 } } } \ No newline at end of file diff --git a/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ADTReading.scala b/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ADTReading.scala index ad469c868..070ca0e2c 100644 --- a/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ADTReading.scala +++ b/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ADTReading.scala @@ -121,11 +121,19 @@ class ADTReading extends ADTBenchmark { @Benchmark def zioJson(): ADTBase = { - import com.github.plokhotnyuk.jsoniter_scala.benchmark.ZioJSONEncoderDecoders._ - import zio.json._ - import zio.json.JsonDecoder._ + import com.github.plokhotnyuk.jsoniter_scala.benchmark.ZioJsonCodecs._ + import zio.json.DecoderOps import java.nio.charset.StandardCharsets.UTF_8 new String(jsonBytes, UTF_8).fromJson[ADTBase].fold(sys.error, identity) } +/* FIXME: zio-schema-json throws java.lang.RuntimeException: .type.Z.l.type(unrecognized subtype) + @Benchmark + def zioSchemaJson(): ADTBase = { + import com.github.plokhotnyuk.jsoniter_scala.benchmark.ZioSchemaJsonCodecs._ + import java.nio.charset.StandardCharsets.UTF_8 + + adtCodec.decodeJson(new String(jsonBytes, UTF_8)).fold(sys.error, identity) + } +*/ } \ No newline at end of file diff --git a/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ADTWriting.scala b/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ADTWriting.scala index 46a2bf780..2f2fd86d6 100644 --- a/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ADTWriting.scala +++ b/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ADTWriting.scala @@ -131,11 +131,20 @@ class ADTWriting extends ADTBenchmark { @Benchmark def zioJson(): Array[Byte] = { - import com.github.plokhotnyuk.jsoniter_scala.benchmark.ZioJSONEncoderDecoders._ - import zio.json._ + import com.github.plokhotnyuk.jsoniter_scala.benchmark.ZioJsonCodecs._ + import zio.json.EncoderOps import zio.json.JsonEncoder._ import java.nio.charset.StandardCharsets.UTF_8 obj.toJson.getBytes(UTF_8) } +/* FIXME: zio-schema-json doesn't serialize the discriminator field + @Benchmark + def zioSchemaJson(): Array[Byte] = { + import com.github.plokhotnyuk.jsoniter_scala.benchmark.ZioSchemaJsonCodecs._ + import java.nio.charset.StandardCharsets.UTF_8 + + adtCodec.encodeJson(obj, None).toString.getBytes(UTF_8) + } +*/ } \ No newline at end of file diff --git a/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/AnyValsReading.scala b/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/AnyValsReading.scala index 80a0db469..aa00bee86 100644 --- a/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/AnyValsReading.scala +++ b/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/AnyValsReading.scala @@ -128,11 +128,18 @@ class AnyValsReading extends AnyValsBenchmark { @Benchmark def zioJson(): AnyVals = { - import com.github.plokhotnyuk.jsoniter_scala.benchmark.ZioJSONEncoderDecoders._ - import zio.json._ - import zio.json.JsonDecoder._ + import com.github.plokhotnyuk.jsoniter_scala.benchmark.ZioJsonCodecs._ + import zio.json.DecoderOps import java.nio.charset.StandardCharsets.UTF_8 new String(jsonBytes, UTF_8).fromJson[AnyVals].fold(sys.error, identity) } + + @Benchmark + def zioSchemaJson(): AnyVals = { + import com.github.plokhotnyuk.jsoniter_scala.benchmark.ZioSchemaJsonCodecs._ + import java.nio.charset.StandardCharsets.UTF_8 + + anyValsCodec.decodeJson(new String(jsonBytes, UTF_8)).fold(sys.error, identity) + } } \ No newline at end of file diff --git a/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/AnyValsWriting.scala b/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/AnyValsWriting.scala index 563abc5eb..6b9d0a15b 100644 --- a/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/AnyValsWriting.scala +++ b/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/AnyValsWriting.scala @@ -138,11 +138,18 @@ class AnyValsWriting extends AnyValsBenchmark { @Benchmark def zioJson(): Array[Byte] = { - import com.github.plokhotnyuk.jsoniter_scala.benchmark.ZioJSONEncoderDecoders._ - import zio.json._ - import zio.json.JsonEncoder._ + import com.github.plokhotnyuk.jsoniter_scala.benchmark.ZioJsonCodecs._ + import zio.json.EncoderOps import java.nio.charset.StandardCharsets.UTF_8 obj.toJson.getBytes(UTF_8) } + + @Benchmark + def zioSchemaJson(): Array[Byte] = { + import com.github.plokhotnyuk.jsoniter_scala.benchmark.ZioSchemaJsonCodecs._ + import java.nio.charset.StandardCharsets.UTF_8 + + anyValsCodec.encodeJson(obj, None).toString.getBytes(UTF_8) + } } \ No newline at end of file diff --git a/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayBufferOfBooleansWriting.scala b/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayBufferOfBooleansWriting.scala index 9992c1c75..c92ee0823 100644 --- a/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayBufferOfBooleansWriting.scala +++ b/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayBufferOfBooleansWriting.scala @@ -126,7 +126,7 @@ class ArrayBufferOfBooleansWriting extends ArrayBufferOfBooleansBenchmark { @Benchmark def zioJson(): Array[Byte] = { - import zio.json._ + import zio.json.EncoderOps import java.nio.charset.StandardCharsets.UTF_8 obj.toJson.getBytes(UTF_8) diff --git a/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfBigDecimalsReading.scala b/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfBigDecimalsReading.scala index 47c3d2eba..5d0a0dc61 100644 --- a/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfBigDecimalsReading.scala +++ b/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfBigDecimalsReading.scala @@ -126,7 +126,7 @@ class ArrayOfBigDecimalsReading extends ArrayOfBigDecimalsBenchmark { @Benchmark def zioJson(): Array[BigDecimal] = { - import zio.json._ + import zio.json.DecoderOps import java.nio.charset.StandardCharsets.UTF_8 new String(jsonBytes, UTF_8).fromJson[Array[BigDecimal]].fold(sys.error, identity) diff --git a/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfBigDecimalsWriting.scala b/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfBigDecimalsWriting.scala index 9ae38bc9a..865931b71 100644 --- a/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfBigDecimalsWriting.scala +++ b/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfBigDecimalsWriting.scala @@ -135,7 +135,7 @@ class ArrayOfBigDecimalsWriting extends ArrayOfBigDecimalsBenchmark { */ @Benchmark def zioJson(): Array[Byte] = { - import zio.json._ + import zio.json.EncoderOps import java.nio.charset.StandardCharsets.UTF_8 obj.toJson.getBytes(UTF_8) diff --git a/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfBigIntsReading.scala b/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfBigIntsReading.scala index bb4a3c120..9a701b34f 100644 --- a/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfBigIntsReading.scala +++ b/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfBigIntsReading.scala @@ -127,7 +127,7 @@ class ArrayOfBigIntsReading extends ArrayOfBigIntsBenchmark { @Benchmark def zioJson(): Array[BigInt] = { - import zio.json._ + import zio.json.DecoderOps import java.nio.charset.StandardCharsets.UTF_8 new String(jsonBytes, UTF_8).fromJson[Array[BigInt]].fold(sys.error, identity) diff --git a/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfBigIntsWriting.scala b/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfBigIntsWriting.scala index 305816875..aa6d03d4a 100644 --- a/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfBigIntsWriting.scala +++ b/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfBigIntsWriting.scala @@ -136,7 +136,7 @@ class ArrayOfBigIntsWriting extends ArrayOfBigIntsBenchmark { */ @Benchmark def zioJson(): Array[Byte] = { - import zio.json._ + import zio.json.EncoderOps import java.nio.charset.StandardCharsets.UTF_8 obj.toJson.getBytes(UTF_8) diff --git a/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfBooleansWriting.scala b/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfBooleansWriting.scala index 32815838c..ba8ff5957 100644 --- a/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfBooleansWriting.scala +++ b/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfBooleansWriting.scala @@ -135,7 +135,7 @@ class ArrayOfBooleansWriting extends ArrayOfBooleansBenchmark { @Benchmark def zioJson(): Array[Byte] = { - import zio.json._ + import zio.json.EncoderOps import java.nio.charset.StandardCharsets.UTF_8 obj.toJson.getBytes(UTF_8) diff --git a/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfBytesWriting.scala b/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfBytesWriting.scala index 253c46681..df089fe78 100644 --- a/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfBytesWriting.scala +++ b/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfBytesWriting.scala @@ -136,7 +136,7 @@ class ArrayOfBytesWriting extends ArrayOfBytesBenchmark { @Benchmark def zioJson(): Array[Byte] = { - import zio.json._ + import zio.json.EncoderOps import java.nio.charset.StandardCharsets.UTF_8 obj.toJson.getBytes(UTF_8) diff --git a/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfCharsWriting.scala b/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfCharsWriting.scala index b9f985487..2491d84b4 100644 --- a/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfCharsWriting.scala +++ b/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfCharsWriting.scala @@ -122,7 +122,7 @@ class ArrayOfCharsWriting extends ArrayOfCharsBenchmark { @Benchmark def zioJson(): Array[Byte] = { - import zio.json._ + import zio.json.EncoderOps import java.nio.charset.StandardCharsets.UTF_8 obj.toJson.getBytes(UTF_8) diff --git a/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfDoublesWriting.scala b/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfDoublesWriting.scala index 5d65c6b55..99864a7aa 100644 --- a/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfDoublesWriting.scala +++ b/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfDoublesWriting.scala @@ -135,7 +135,7 @@ class ArrayOfDoublesWriting extends ArrayOfDoublesBenchmark { @Benchmark def zioJson(): Array[Byte] = { - import zio.json._ + import zio.json.EncoderOps import java.nio.charset.StandardCharsets.UTF_8 obj.toJson.getBytes(UTF_8) diff --git a/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfDurationsWriting.scala b/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfDurationsWriting.scala index f28741a4f..a3ce63f9d 100644 --- a/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfDurationsWriting.scala +++ b/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfDurationsWriting.scala @@ -123,7 +123,7 @@ class ArrayOfDurationsWriting extends ArrayOfDurationsBenchmark { @Benchmark def zioJson(): Array[Byte] = { - import zio.json._ + import zio.json.EncoderOps import java.nio.charset.StandardCharsets.UTF_8 obj.toJson.getBytes(UTF_8) diff --git a/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfEnumADTsReading.scala b/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfEnumADTsReading.scala index 12cfecde2..ba62f2b65 100644 --- a/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfEnumADTsReading.scala +++ b/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfEnumADTsReading.scala @@ -120,9 +120,9 @@ class ArrayOfEnumADTsReading extends ArrayOfEnumADTsBenchmark { @Benchmark def zioJson(): Array[SuitADT] = { - import zio.json._ + import zio.json.DecoderOps import java.nio.charset.StandardCharsets.UTF_8 - new String(jsonBytes, UTF_8).fromJson[Array[SuitADT]](ZioJSONEncoderDecoders.arrayOfEnumADTsC3c.decoder).fold(sys.error, identity) + new String(jsonBytes, UTF_8).fromJson[Array[SuitADT]](ZioJsonCodecs.arrayOfEnumADTsC3c.decoder).fold(sys.error, identity) } } \ No newline at end of file diff --git a/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfEnumADTsWriting.scala b/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfEnumADTsWriting.scala index 6f85ebf43..3a1db322e 100644 --- a/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfEnumADTsWriting.scala +++ b/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfEnumADTsWriting.scala @@ -130,9 +130,9 @@ class ArrayOfEnumADTsWriting extends ArrayOfEnumADTsBenchmark { @Benchmark def zioJson(): Array[Byte] = { - import zio.json._ + import zio.json.EncoderOps import java.nio.charset.StandardCharsets.UTF_8 - obj.toJson(ZioJSONEncoderDecoders.arrayOfEnumADTsC3c.encoder).getBytes(UTF_8) + obj.toJson(ZioJsonCodecs.arrayOfEnumADTsC3c.encoder).getBytes(UTF_8) } } \ No newline at end of file diff --git a/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfEnumsReading.scala b/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfEnumsReading.scala index 1a6949fce..c87d73610 100644 --- a/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfEnumsReading.scala +++ b/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfEnumsReading.scala @@ -114,9 +114,9 @@ class ArrayOfEnumsReading extends ArrayOfEnumsBenchmark { @Benchmark def zioJson(): Array[SuitEnum] = { - import zio.json._ + import zio.json.DecoderOps import java.nio.charset.StandardCharsets.UTF_8 - new String(jsonBytes, UTF_8).fromJson[Array[SuitEnum]](ZioJSONEncoderDecoders.arrayOfEnumsC3c.decoder).fold(sys.error, identity) + new String(jsonBytes, UTF_8).fromJson[Array[SuitEnum]](ZioJsonCodecs.arrayOfEnumsC3c.decoder).fold(sys.error, identity) } } \ No newline at end of file diff --git a/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfEnumsWriting.scala b/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfEnumsWriting.scala index 71e2c1850..3444b6f37 100644 --- a/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfEnumsWriting.scala +++ b/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfEnumsWriting.scala @@ -123,9 +123,9 @@ class ArrayOfEnumsWriting extends ArrayOfEnumsBenchmark { @Benchmark def zioJson(): Array[Byte] = { - import zio.json._ + import zio.json.EncoderOps import java.nio.charset.StandardCharsets.UTF_8 - obj.toJson(ZioJSONEncoderDecoders.arrayOfEnumsC3c.encoder).getBytes(UTF_8) + obj.toJson(ZioJsonCodecs.arrayOfEnumsC3c.encoder).getBytes(UTF_8) } } \ No newline at end of file diff --git a/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfFloatsWriting.scala b/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfFloatsWriting.scala index 32e4af2e1..09686f8a7 100644 --- a/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfFloatsWriting.scala +++ b/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfFloatsWriting.scala @@ -135,7 +135,7 @@ class ArrayOfFloatsWriting extends ArrayOfFloatsBenchmark { @Benchmark def zioJson(): Array[Byte] = { - import zio.json._ + import zio.json.EncoderOps import java.nio.charset.StandardCharsets.UTF_8 obj.toJson.getBytes(UTF_8) diff --git a/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfInstantsWriting.scala b/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfInstantsWriting.scala index 8f51c683c..791020f97 100644 --- a/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfInstantsWriting.scala +++ b/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfInstantsWriting.scala @@ -131,7 +131,7 @@ class ArrayOfInstantsWriting extends ArrayOfInstantsBenchmark { @Benchmark def zioJson(): Array[Byte] = { - import zio.json._ + import zio.json.EncoderOps import java.nio.charset.StandardCharsets.UTF_8 obj.toJson.getBytes(UTF_8) diff --git a/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfIntsReading.scala b/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfIntsReading.scala index dceaf3497..cba5a62d1 100644 --- a/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfIntsReading.scala +++ b/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfIntsReading.scala @@ -124,7 +124,7 @@ class ArrayOfIntsReading extends ArrayOfIntsBenchmark { @Benchmark def zioJson(): Array[Int] = { - import zio.json._ + import zio.json.DecoderOps import java.nio.charset.StandardCharsets.UTF_8 new String(jsonBytes, UTF_8).fromJson[Array[Int]].fold(sys.error, identity) diff --git a/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfIntsWriting.scala b/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfIntsWriting.scala index a9948f0d1..25a6999f2 100644 --- a/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfIntsWriting.scala +++ b/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfIntsWriting.scala @@ -135,7 +135,7 @@ class ArrayOfIntsWriting extends ArrayOfIntsBenchmark { @Benchmark def zioJson(): Array[Byte] = { - import zio.json._ + import zio.json.EncoderOps import java.nio.charset.StandardCharsets.UTF_8 obj.toJson.getBytes(UTF_8) diff --git a/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfLocalDateTimesWriting.scala b/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfLocalDateTimesWriting.scala index 97546cf6e..45cbe0ea4 100644 --- a/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfLocalDateTimesWriting.scala +++ b/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfLocalDateTimesWriting.scala @@ -130,7 +130,7 @@ class ArrayOfLocalDateTimesWriting extends ArrayOfLocalDateTimesBenchmark { @Benchmark def zioJson(): Array[Byte] = { - import zio.json._ + import zio.json.EncoderOps import java.nio.charset.StandardCharsets.UTF_8 obj.toJson.getBytes(UTF_8) diff --git a/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfLocalDatesWriting.scala b/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfLocalDatesWriting.scala index 3d7d49240..ba628d245 100644 --- a/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfLocalDatesWriting.scala +++ b/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfLocalDatesWriting.scala @@ -130,7 +130,7 @@ class ArrayOfLocalDatesWriting extends ArrayOfLocalDatesBenchmark { @Benchmark def zioJson(): Array[Byte] = { - import zio.json._ + import zio.json.EncoderOps import java.nio.charset.StandardCharsets.UTF_8 obj.toJson.getBytes(UTF_8) diff --git a/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfLocalTimesWriting.scala b/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfLocalTimesWriting.scala index 4beb48a3c..19c0b82ad 100644 --- a/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfLocalTimesWriting.scala +++ b/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfLocalTimesWriting.scala @@ -130,7 +130,7 @@ class ArrayOfLocalTimesWriting extends ArrayOfLocalTimesBenchmark { @Benchmark def zioJson(): Array[Byte] = { - import zio.json._ + import zio.json.EncoderOps import java.nio.charset.StandardCharsets.UTF_8 obj.toJson.getBytes(UTF_8) diff --git a/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfLongsWriting.scala b/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfLongsWriting.scala index e040f0ae0..610435835 100644 --- a/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfLongsWriting.scala +++ b/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfLongsWriting.scala @@ -135,7 +135,7 @@ class ArrayOfLongsWriting extends ArrayOfLongsBenchmark { @Benchmark def zioJson(): Array[Byte] = { - import zio.json._ + import zio.json.EncoderOps import java.nio.charset.StandardCharsets.UTF_8 obj.toJson.getBytes(UTF_8) diff --git a/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfMonthDaysWriting.scala b/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfMonthDaysWriting.scala index 80c9e15d7..13ca44e2f 100644 --- a/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfMonthDaysWriting.scala +++ b/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfMonthDaysWriting.scala @@ -123,7 +123,7 @@ class ArrayOfMonthDaysWriting extends ArrayOfMonthDaysBenchmark { @Benchmark def zioJson(): Array[Byte] = { - import zio.json._ + import zio.json.EncoderOps import java.nio.charset.StandardCharsets.UTF_8 obj.toJson.getBytes(UTF_8) diff --git a/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfOffsetDateTimesWriting.scala b/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfOffsetDateTimesWriting.scala index 48197cfd0..c13bbee17 100644 --- a/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfOffsetDateTimesWriting.scala +++ b/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfOffsetDateTimesWriting.scala @@ -130,7 +130,7 @@ class ArrayOfOffsetDateTimesWriting extends ArrayOfOffsetDateTimesBenchmark { @Benchmark def zioJson(): Array[Byte] = { - import zio.json._ + import zio.json.EncoderOps import java.nio.charset.StandardCharsets.UTF_8 obj.toJson.getBytes(UTF_8) diff --git a/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfOffsetTimesWriting.scala b/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfOffsetTimesWriting.scala index 288b574fe..b435d81a9 100644 --- a/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfOffsetTimesWriting.scala +++ b/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfOffsetTimesWriting.scala @@ -130,7 +130,7 @@ class ArrayOfOffsetTimesWriting extends ArrayOfOffsetTimesBenchmark { @Benchmark def zioJson(): Array[Byte] = { - import zio.json._ + import zio.json.EncoderOps import java.nio.charset.StandardCharsets.UTF_8 obj.toJson.getBytes(UTF_8) diff --git a/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfPeriodsWriting.scala b/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfPeriodsWriting.scala index 30cf4bdaf..dc371a763 100644 --- a/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfPeriodsWriting.scala +++ b/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfPeriodsWriting.scala @@ -123,7 +123,7 @@ class ArrayOfPeriodsWriting extends ArrayOfPeriodsBenchmark { @Benchmark def zioJson(): Array[Byte] = { - import zio.json._ + import zio.json.EncoderOps import java.nio.charset.StandardCharsets.UTF_8 obj.toJson.getBytes(UTF_8) diff --git a/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfShortsReading.scala b/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfShortsReading.scala index 9a7dddea1..8542a0f85 100644 --- a/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfShortsReading.scala +++ b/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfShortsReading.scala @@ -124,7 +124,7 @@ class ArrayOfShortsReading extends ArrayOfShortsBenchmark { @Benchmark def zioJson(): Array[Short] = { - import zio.json._ + import zio.json.DecoderOps import java.nio.charset.StandardCharsets.UTF_8 new String(jsonBytes, UTF_8).fromJson[Array[Short]].fold(sys.error, identity) diff --git a/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfShortsWriting.scala b/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfShortsWriting.scala index 98647aca2..65f8b462c 100644 --- a/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfShortsWriting.scala +++ b/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfShortsWriting.scala @@ -135,7 +135,7 @@ class ArrayOfShortsWriting extends ArrayOfShortsBenchmark { @Benchmark def zioJson(): Array[Byte] = { - import zio.json._ + import zio.json.EncoderOps import java.nio.charset.StandardCharsets.UTF_8 obj.toJson.getBytes(UTF_8) diff --git a/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfUUIDsWriting.scala b/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfUUIDsWriting.scala index dd21c1030..6c7eda4ca 100644 --- a/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfUUIDsWriting.scala +++ b/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfUUIDsWriting.scala @@ -136,7 +136,7 @@ class ArrayOfUUIDsWriting extends ArrayOfUUIDsBenchmark { @Benchmark def zioJson(): Array[Byte] = { - import zio.json._ + import zio.json.EncoderOps import java.nio.charset.StandardCharsets.UTF_8 obj.toJson.getBytes(UTF_8) diff --git a/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfYearMonthsWriting.scala b/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfYearMonthsWriting.scala index 48181fa5d..0d89688bc 100644 --- a/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfYearMonthsWriting.scala +++ b/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfYearMonthsWriting.scala @@ -123,7 +123,7 @@ class ArrayOfYearMonthsWriting extends ArrayOfYearMonthsBenchmark { @Benchmark def zioJson(): Array[Byte] = { - import zio.json._ + import zio.json.EncoderOps import java.nio.charset.StandardCharsets.UTF_8 obj.toJson.getBytes(UTF_8) diff --git a/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfYearsWriting.scala b/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfYearsWriting.scala index 1c302bab9..6ba68184b 100644 --- a/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfYearsWriting.scala +++ b/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfYearsWriting.scala @@ -123,7 +123,7 @@ class ArrayOfYearsWriting extends ArrayOfYearsBenchmark { @Benchmark def zioJson(): Array[Byte] = { - import zio.json._ + import zio.json.EncoderOps import java.nio.charset.StandardCharsets.UTF_8 obj.toJson.getBytes(UTF_8) diff --git a/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfZoneIdsWriting.scala b/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfZoneIdsWriting.scala index 254cc4d75..434943dac 100644 --- a/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfZoneIdsWriting.scala +++ b/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfZoneIdsWriting.scala @@ -123,7 +123,7 @@ class ArrayOfZoneIdsWriting extends ArrayOfZoneIdsBenchmark { @Benchmark def zioJson(): Array[Byte] = { - import zio.json._ + import zio.json.EncoderOps import java.nio.charset.StandardCharsets.UTF_8 obj.toJson.getBytes(UTF_8) diff --git a/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfZoneOffsetsWriting.scala b/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfZoneOffsetsWriting.scala index 35d7c73a8..8562293e7 100644 --- a/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfZoneOffsetsWriting.scala +++ b/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfZoneOffsetsWriting.scala @@ -123,7 +123,7 @@ class ArrayOfZoneOffsetsWriting extends ArrayOfZoneOffsetsBenchmark { @Benchmark def zioJson(): Array[Byte] = { - import zio.json._ + import zio.json.EncoderOps import java.nio.charset.StandardCharsets.UTF_8 obj.toJson.getBytes(UTF_8) diff --git a/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfZonedDateTimesWriting.scala b/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfZonedDateTimesWriting.scala index e73ed4d95..952c56642 100644 --- a/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfZonedDateTimesWriting.scala +++ b/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfZonedDateTimesWriting.scala @@ -130,7 +130,7 @@ class ArrayOfZonedDateTimesWriting extends ArrayOfZonedDateTimesBenchmark { @Benchmark def zioJson(): Array[Byte] = { - import zio.json._ + import zio.json.EncoderOps import java.nio.charset.StandardCharsets.UTF_8 obj.toJson.getBytes(UTF_8) diff --git a/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArraySeqOfBooleansReading.scala b/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArraySeqOfBooleansReading.scala index 009594a21..3795054d6 100644 --- a/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArraySeqOfBooleansReading.scala +++ b/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArraySeqOfBooleansReading.scala @@ -125,9 +125,9 @@ class ArraySeqOfBooleansReading extends ArraySeqOfBooleansBenchmark { @Benchmark def zioJson(): ArraySeq[Boolean] = { + import com.github.plokhotnyuk.jsoniter_scala.benchmark.ZioJsonCodecs._ import zio.json.DecoderOps import java.nio.charset.StandardCharsets.UTF_8 - import com.github.plokhotnyuk.jsoniter_scala.benchmark.ZioJSONEncoderDecoders._ new String(jsonBytes, UTF_8).fromJson[ArraySeq[Boolean]].fold(sys.error, identity) } diff --git a/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArraySeqOfBooleansWriting.scala b/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArraySeqOfBooleansWriting.scala index 43ffb37d7..6c5853db6 100644 --- a/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArraySeqOfBooleansWriting.scala +++ b/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArraySeqOfBooleansWriting.scala @@ -134,7 +134,7 @@ class ArraySeqOfBooleansWriting extends ArraySeqOfBooleansBenchmark { @Benchmark def zioJson(): Array[Byte] = { - import zio.json._ + import zio.json.EncoderOps import java.nio.charset.StandardCharsets.UTF_8 obj.toJson.getBytes(UTF_8) diff --git a/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/Base64Reading.scala b/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/Base64Reading.scala index a33d10d84..6374cabe9 100644 --- a/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/Base64Reading.scala +++ b/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/Base64Reading.scala @@ -128,8 +128,8 @@ class Base64Reading extends Base64Benchmark { @Benchmark def zioJson(): Array[Byte] = { - import com.github.plokhotnyuk.jsoniter_scala.benchmark.ZioJSONEncoderDecoders._ - import zio.json._ + import com.github.plokhotnyuk.jsoniter_scala.benchmark.ZioJsonCodecs._ + import zio.json.DecoderOps import java.nio.charset.StandardCharsets.UTF_8 new String(jsonBytes, UTF_8).fromJson[Array[Byte]](base64C3c.decoder).fold(sys.error, identity) diff --git a/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/Base64Writing.scala b/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/Base64Writing.scala index a9420932b..b486a4af2 100644 --- a/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/Base64Writing.scala +++ b/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/Base64Writing.scala @@ -137,8 +137,8 @@ class Base64Writing extends Base64Benchmark { @Benchmark def zioJson(): Array[Byte] = { - import com.github.plokhotnyuk.jsoniter_scala.benchmark.ZioJSONEncoderDecoders._ - import zio.json._ + import com.github.plokhotnyuk.jsoniter_scala.benchmark.ZioJsonCodecs._ + import zio.json.EncoderOps import java.nio.charset.StandardCharsets.UTF_8 obj.toJson(base64C3c.encoder).getBytes(UTF_8) diff --git a/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/BigDecimalWriting.scala b/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/BigDecimalWriting.scala index 9c4a3f2db..1bf6db721 100644 --- a/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/BigDecimalWriting.scala +++ b/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/BigDecimalWriting.scala @@ -135,7 +135,7 @@ class BigDecimalWriting extends BigDecimalBenchmark { */ @Benchmark def zioJson(): Array[Byte] = { - import zio.json._ + import zio.json.EncoderOps import java.nio.charset.StandardCharsets.UTF_8 obj.toJson.getBytes(UTF_8) diff --git a/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/BigIntWriting.scala b/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/BigIntWriting.scala index ab29ca55c..2cf5865f7 100644 --- a/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/BigIntWriting.scala +++ b/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/BigIntWriting.scala @@ -135,7 +135,7 @@ class BigIntWriting extends BigIntBenchmark { */ @Benchmark def zioJson(): Array[Byte] = { - import zio.json._ + import zio.json.EncoderOps import java.nio.charset.StandardCharsets.UTF_8 obj.toJson.getBytes(UTF_8) diff --git a/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ExtractFieldsReading.scala b/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ExtractFieldsReading.scala index aa9689e18..ffe76710e 100644 --- a/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ExtractFieldsReading.scala +++ b/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ExtractFieldsReading.scala @@ -128,11 +128,18 @@ class ExtractFieldsReading extends ExtractFieldsBenchmark { @Benchmark def zioJson(): ExtractFields = { - import com.github.plokhotnyuk.jsoniter_scala.benchmark.ZioJSONEncoderDecoders._ - import zio.json._ - import zio.json.JsonDecoder._ + import com.github.plokhotnyuk.jsoniter_scala.benchmark.ZioJsonCodecs._ + import zio.json.DecoderOps import java.nio.charset.StandardCharsets.UTF_8 new String(jsonBytes, UTF_8).fromJson[ExtractFields].fold(sys.error, identity) } + + @Benchmark + def zioSchemaJson(): ExtractFields = { + import com.github.plokhotnyuk.jsoniter_scala.benchmark.ZioSchemaJsonCodecs._ + import java.nio.charset.StandardCharsets.UTF_8 + + extractFieldsCodec.decodeJson(new String(jsonBytes, UTF_8)).fold(sys.error, identity) + } } \ No newline at end of file diff --git a/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/GeoJSONReading.scala b/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/GeoJSONReading.scala index 2e8d57a85..3e0a30da7 100644 --- a/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/GeoJSONReading.scala +++ b/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/GeoJSONReading.scala @@ -121,11 +121,19 @@ class GeoJSONReading extends GeoJSONBenchmark { @Benchmark def zioJson(): GeoJSON = { - import com.github.plokhotnyuk.jsoniter_scala.benchmark.ZioJSONEncoderDecoders._ - import zio.json._ - import zio.json.JsonDecoder._ + import com.github.plokhotnyuk.jsoniter_scala.benchmark.ZioJsonCodecs._ + import zio.json.DecoderOps import java.nio.charset.StandardCharsets.UTF_8 new String(jsonBytes, UTF_8).fromJson[GeoJSON].fold(sys.error, identity) } +/* FIXME: zio-schema-json throws java.lang.RuntimeException: .type.FeatureCollection.features[0].type.Feature.geometry.type.Polygon(unrecognized subtype) + @Benchmark + def zioSchemaJson(): GeoJSON = { + import com.github.plokhotnyuk.jsoniter_scala.benchmark.ZioSchemaJsonCodecs._ + import java.nio.charset.StandardCharsets.UTF_8 + + geoJSONCodec.decodeJson(new String(jsonBytes, UTF_8)).fold(sys.error, identity) + } +*/ } \ No newline at end of file diff --git a/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/GeoJSONWriting.scala b/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/GeoJSONWriting.scala index 20663fe59..70ab9e1f9 100644 --- a/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/GeoJSONWriting.scala +++ b/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/GeoJSONWriting.scala @@ -131,11 +131,18 @@ class GeoJSONWriting extends GeoJSONBenchmark { @Benchmark def zioJson(): Array[Byte] = { - import com.github.plokhotnyuk.jsoniter_scala.benchmark.ZioJSONEncoderDecoders._ - import zio.json._ - import zio.json.JsonEncoder._ + import com.github.plokhotnyuk.jsoniter_scala.benchmark.ZioJsonCodecs._ + import zio.json.EncoderOps import java.nio.charset.StandardCharsets.UTF_8 obj.toJson.getBytes(UTF_8) } + + @Benchmark + def zioSchemaJson(): Array[Byte] = { + import com.github.plokhotnyuk.jsoniter_scala.benchmark.ZioSchemaJsonCodecs._ + import java.nio.charset.StandardCharsets.UTF_8 + + geoJsonCodec.encodeJson(obj, None).toString.getBytes(UTF_8) + } } \ No newline at end of file diff --git a/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/GitHubActionsAPIReading.scala b/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/GitHubActionsAPIReading.scala index dadce9aa1..91e035bcc 100644 --- a/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/GitHubActionsAPIReading.scala +++ b/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/GitHubActionsAPIReading.scala @@ -121,11 +121,18 @@ class GitHubActionsAPIReading extends GitHubActionsAPIBenchmark { @Benchmark def zioJson(): GitHubActionsAPI.Response = { - import com.github.plokhotnyuk.jsoniter_scala.benchmark.ZioJSONEncoderDecoders._ - import zio.json._ - import zio.json.JsonDecoder._ + import com.github.plokhotnyuk.jsoniter_scala.benchmark.ZioJsonCodecs._ + import zio.json.DecoderOps import java.nio.charset.StandardCharsets.UTF_8 new String(jsonBytes, UTF_8).fromJson[GitHubActionsAPI.Response].fold(sys.error, identity) } + + @Benchmark + def zioSchemaJson(): GitHubActionsAPI.Response = { + import com.github.plokhotnyuk.jsoniter_scala.benchmark.ZioSchemaJsonCodecs._ + import java.nio.charset.StandardCharsets.UTF_8 + + gitHubActionsAPICodec.decodeJson(new String(jsonBytes, UTF_8)).fold(sys.error, identity) + } } \ No newline at end of file diff --git a/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/GitHubActionsAPIWriting.scala b/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/GitHubActionsAPIWriting.scala index a10857af2..6664b98c0 100644 --- a/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/GitHubActionsAPIWriting.scala +++ b/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/GitHubActionsAPIWriting.scala @@ -131,11 +131,18 @@ class GitHubActionsAPIWriting extends GitHubActionsAPIBenchmark { @Benchmark def zioJson(): Array[Byte] = { - import com.github.plokhotnyuk.jsoniter_scala.benchmark.ZioJSONEncoderDecoders._ - import zio.json._ - import zio.json.JsonEncoder._ + import com.github.plokhotnyuk.jsoniter_scala.benchmark.ZioJsonCodecs._ + import zio.json.EncoderOps import java.nio.charset.StandardCharsets.UTF_8 obj.toJson.getBytes(UTF_8) } + + @Benchmark + def zioSchemaJson(): Array[Byte] = { + import com.github.plokhotnyuk.jsoniter_scala.benchmark.ZioSchemaJsonCodecs._ + import java.nio.charset.StandardCharsets.UTF_8 + + gitHubActionsAPICodec.encodeJson(obj, None).toString.getBytes(UTF_8) + } } \ No newline at end of file diff --git a/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/GoogleMapsAPIPrettyPrinting.scala b/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/GoogleMapsAPIPrettyPrinting.scala index aaecccc3b..7e3b7e038 100644 --- a/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/GoogleMapsAPIPrettyPrinting.scala +++ b/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/GoogleMapsAPIPrettyPrinting.scala @@ -125,10 +125,18 @@ class GoogleMapsAPIPrettyPrinting extends GoogleMapsAPIBenchmark { @Benchmark def zioJson(): Array[Byte] = { - import com.github.plokhotnyuk.jsoniter_scala.benchmark.ZioJSONEncoderDecoders._ + import com.github.plokhotnyuk.jsoniter_scala.benchmark.ZioJsonCodecs._ import zio.json._ import java.nio.charset.StandardCharsets.UTF_8 obj.toJsonPretty.getBytes(UTF_8) } + + @Benchmark + def zioSchemaJson(): Array[Byte] = { + import com.github.plokhotnyuk.jsoniter_scala.benchmark.ZioSchemaJsonCodecs._ + import java.nio.charset.StandardCharsets.UTF_8 + + googleMapsAPICodec.encodeJson(obj, new Some(0)).toString.getBytes(UTF_8) + } } \ No newline at end of file diff --git a/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/GoogleMapsAPIReading.scala b/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/GoogleMapsAPIReading.scala index 14a2f0798..0663b91db 100644 --- a/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/GoogleMapsAPIReading.scala +++ b/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/GoogleMapsAPIReading.scala @@ -129,11 +129,18 @@ class GoogleMapsAPIReading extends GoogleMapsAPIBenchmark { @Benchmark def zioJson(): DistanceMatrix = { - import com.github.plokhotnyuk.jsoniter_scala.benchmark.ZioJSONEncoderDecoders._ - import zio.json._ - import zio.json.JsonDecoder._ + import com.github.plokhotnyuk.jsoniter_scala.benchmark.ZioJsonCodecs._ + import zio.json.DecoderOps import java.nio.charset.StandardCharsets.UTF_8 new String(jsonBytes, UTF_8).fromJson[DistanceMatrix].fold(sys.error, identity) } + + @Benchmark + def zioSchemaJson(): DistanceMatrix = { + import com.github.plokhotnyuk.jsoniter_scala.benchmark.ZioSchemaJsonCodecs._ + import java.nio.charset.StandardCharsets.UTF_8 + + googleMapsAPICodec.decodeJson(new String(jsonBytes, UTF_8)).fold(sys.error, identity) + } } \ No newline at end of file diff --git a/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/GoogleMapsAPIWriting.scala b/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/GoogleMapsAPIWriting.scala index eed910a27..39520b8df 100644 --- a/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/GoogleMapsAPIWriting.scala +++ b/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/GoogleMapsAPIWriting.scala @@ -138,11 +138,18 @@ class GoogleMapsAPIWriting extends GoogleMapsAPIBenchmark { @Benchmark def zioJson(): Array[Byte] = { - import com.github.plokhotnyuk.jsoniter_scala.benchmark.ZioJSONEncoderDecoders._ - import zio.json._ - import zio.json.JsonEncoder._ + import com.github.plokhotnyuk.jsoniter_scala.benchmark.ZioJsonCodecs._ + import zio.json.EncoderOps import java.nio.charset.StandardCharsets.UTF_8 obj.toJson.getBytes(UTF_8) } + + @Benchmark + def zioSchemaJson(): Array[Byte] = { + import com.github.plokhotnyuk.jsoniter_scala.benchmark.ZioSchemaJsonCodecs._ + import java.nio.charset.StandardCharsets.UTF_8 + + googleMapsAPICodec.encodeJson(obj, None).toString.getBytes(UTF_8) + } } \ No newline at end of file diff --git a/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/IntWriting.scala b/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/IntWriting.scala index 33f702d95..67e7256c7 100644 --- a/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/IntWriting.scala +++ b/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/IntWriting.scala @@ -135,7 +135,7 @@ class IntWriting extends IntBenchmark { @Benchmark def zioJson(): Array[Byte] = { - import zio.json._ + import zio.json.EncoderOps import java.nio.charset.StandardCharsets.UTF_8 obj.toJson.getBytes(UTF_8) diff --git a/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ListOfBooleansWriting.scala b/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ListOfBooleansWriting.scala index 5d01885a6..c793627e6 100644 --- a/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ListOfBooleansWriting.scala +++ b/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/ListOfBooleansWriting.scala @@ -134,7 +134,7 @@ class ListOfBooleansWriting extends ListOfBooleansBenchmark { @Benchmark def zioJson(): Array[Byte] = { - import zio.json._ + import zio.json.EncoderOps import java.nio.charset.StandardCharsets.UTF_8 obj.toJson.getBytes(UTF_8) diff --git a/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/MapOfIntsToBooleansReading.scala b/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/MapOfIntsToBooleansReading.scala index a7a1f245d..02d7ec3e6 100644 --- a/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/MapOfIntsToBooleansReading.scala +++ b/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/MapOfIntsToBooleansReading.scala @@ -116,7 +116,7 @@ class MapOfIntsToBooleansReading extends MapOfIntsToBooleansBenchmark { @Benchmark def zioJson(): Map[Int, Boolean] = { - import zio.json._ + import zio.json.DecoderOps import java.nio.charset.StandardCharsets.UTF_8 new String(jsonBytes, UTF_8).fromJson[Map[Int, Boolean]].fold(sys.error, identity) diff --git a/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/MapOfIntsToBooleansWriting.scala b/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/MapOfIntsToBooleansWriting.scala index dc9a7cc4e..ea0a2c2a7 100644 --- a/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/MapOfIntsToBooleansWriting.scala +++ b/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/MapOfIntsToBooleansWriting.scala @@ -126,7 +126,7 @@ class MapOfIntsToBooleansWriting extends MapOfIntsToBooleansBenchmark { @Benchmark def zioJson(): Array[Byte] = { - import zio.json._ + import zio.json.EncoderOps import java.nio.charset.StandardCharsets.UTF_8 obj.toJson.getBytes(UTF_8) diff --git a/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/MissingRequiredFieldsReading.scala b/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/MissingRequiredFieldsReading.scala index eba183607..ac30f0db1 100644 --- a/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/MissingRequiredFieldsReading.scala +++ b/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/MissingRequiredFieldsReading.scala @@ -212,11 +212,18 @@ class MissingRequiredFieldsReading extends MissingRequiredFieldsBenchmark { @Benchmark def zioJson(): String = { - import com.github.plokhotnyuk.jsoniter_scala.benchmark.ZioJSONEncoderDecoders._ - import zio.json._ - import zio.json.JsonDecoder._ + import com.github.plokhotnyuk.jsoniter_scala.benchmark.ZioJsonCodecs._ + import zio.json.DecoderOps import java.nio.charset.StandardCharsets.UTF_8 new String(jsonBytes, UTF_8).fromJson[MissingRequiredFields].fold(identity, _.toString) // toString shouldn't be called } + + @Benchmark + def zioSchemaJson(): String = { + import com.github.plokhotnyuk.jsoniter_scala.benchmark.ZioSchemaJsonCodecs._ + import java.nio.charset.StandardCharsets.UTF_8 + + missingRequiredFieldsCodec.decodeJson(new String(jsonBytes, UTF_8)).fold(identity, _.toString) // toString shouldn't be called + } } \ No newline at end of file diff --git a/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/MutableMapOfIntsToBooleansWriting.scala b/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/MutableMapOfIntsToBooleansWriting.scala index 3ad564289..3a447ead6 100644 --- a/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/MutableMapOfIntsToBooleansWriting.scala +++ b/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/MutableMapOfIntsToBooleansWriting.scala @@ -110,7 +110,7 @@ class MutableMapOfIntsToBooleansWriting extends MutableMapOfIntsToBooleansBenchm @Benchmark def zioJson(): Array[Byte] = { - import zio.json._ + import zio.json.EncoderOps import java.nio.charset.StandardCharsets.UTF_8 obj.toJson.getBytes(UTF_8) diff --git a/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/MutableSetOfIntsWriting.scala b/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/MutableSetOfIntsWriting.scala index bc1f659ad..2227fa12e 100644 --- a/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/MutableSetOfIntsWriting.scala +++ b/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/MutableSetOfIntsWriting.scala @@ -117,7 +117,7 @@ class MutableSetOfIntsWriting extends MutableSetOfIntsBenchmark { @Benchmark def zioJson(): Array[Byte] = { - import zio.json._ + import zio.json.EncoderOps import java.nio.charset.StandardCharsets.UTF_8 obj.toJson.getBytes(UTF_8) diff --git a/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/NestedStructsReading.scala b/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/NestedStructsReading.scala index b0cee7aef..2c6dc6726 100644 --- a/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/NestedStructsReading.scala +++ b/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/NestedStructsReading.scala @@ -128,11 +128,19 @@ class NestedStructsReading extends NestedStructsBenchmark { @Benchmark def zioJson(): NestedStructs = { - import zio.json._ - import zio.json.JsonDecoder._ - import com.github.plokhotnyuk.jsoniter_scala.benchmark.ZioJSONEncoderDecoders._ - import java.nio.charset.StandardCharsets.UTF_8 + import com.github.plokhotnyuk.jsoniter_scala.benchmark.ZioJsonCodecs._ + import zio.json.DecoderOps + import java.nio.charset.StandardCharsets.UTF_8 new String(jsonBytes, UTF_8).fromJson[NestedStructs].fold(sys.error, identity) } +/* FIXME: zio-schema-json parses only 127 levels of nesting instead of 128 + @Benchmark + def zioSchemaJson(): NestedStructs = { + import com.github.plokhotnyuk.jsoniter_scala.benchmark.ZioSchemaJsonCodecs._ + import java.nio.charset.StandardCharsets.UTF_8 + + nestedStructsCodec.decodeJson(new String(jsonBytes, UTF_8)).fold(sys.error, identity) + } +*/ } \ No newline at end of file diff --git a/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/NestedStructsWriting.scala b/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/NestedStructsWriting.scala index f34874604..c0dd59d53 100644 --- a/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/NestedStructsWriting.scala +++ b/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/NestedStructsWriting.scala @@ -138,11 +138,18 @@ class NestedStructsWriting extends NestedStructsBenchmark { @Benchmark def zioJson(): Array[Byte] = { - import com.github.plokhotnyuk.jsoniter_scala.benchmark.ZioJSONEncoderDecoders._ - import zio.json._ - import zio.json.JsonEncoder._ + import com.github.plokhotnyuk.jsoniter_scala.benchmark.ZioJsonCodecs._ + import zio.json.EncoderOps import java.nio.charset.StandardCharsets.UTF_8 obj.toJson.getBytes(UTF_8) } + + @Benchmark + def zioSchemaJson(): Array[Byte] = { + import com.github.plokhotnyuk.jsoniter_scala.benchmark.ZioSchemaJsonCodecs._ + import java.nio.charset.StandardCharsets.UTF_8 + + nestedStructsCodec.encodeJson(obj, None).toString.getBytes(UTF_8) + } } \ No newline at end of file diff --git a/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/OpenRTBReading.scala b/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/OpenRTBReading.scala index 846c6a286..6baa33ec0 100644 --- a/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/OpenRTBReading.scala +++ b/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/OpenRTBReading.scala @@ -122,10 +122,18 @@ class OpenRTBReading extends OpenRTBBenchmark { @Benchmark def zioJson(): BidRequest = { - import com.github.plokhotnyuk.jsoniter_scala.benchmark.ZioJSONEncoderDecoders._ - import zio.json._ + import com.github.plokhotnyuk.jsoniter_scala.benchmark.ZioJsonCodecs._ + import zio.json.DecoderOps import java.nio.charset.StandardCharsets.UTF_8 new String(jsonBytes, UTF_8).fromJson[BidRequest].fold(sys.error, identity) } + + @Benchmark + def zioSchemaJson(): BidRequest = { + import com.github.plokhotnyuk.jsoniter_scala.benchmark.ZioSchemaJsonCodecs._ + import java.nio.charset.StandardCharsets.UTF_8 + + openRTBBidRequestCodec.decodeJson(new String(jsonBytes, UTF_8)).fold(sys.error, identity) + } } \ No newline at end of file diff --git a/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/OpenRTBWriting.scala b/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/OpenRTBWriting.scala index 54736d987..4d922f83f 100644 --- a/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/OpenRTBWriting.scala +++ b/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/OpenRTBWriting.scala @@ -130,15 +130,23 @@ class OpenRTBWriting extends OpenRTBBenchmark { FromScala(obj).transform(ToJson.bytes) } -/* FIXME: Zio-JSON serializes empty collections +/* FIXME: zio-json serializes empty collections @Benchmark def zioJson(): Array[Byte] = { - import com.github.plokhotnyuk.jsoniter_scala.benchmark.ZioJSONEncoderDecoders._ - import zio.json._ - import zio.json.JsonEncoder._ + import com.github.plokhotnyuk.jsoniter_scala.benchmark.ZioJsonCodecs._ + import zio.json.EncoderOps import java.nio.charset.StandardCharsets.UTF_8 obj.toJson.getBytes(UTF_8) } */ +/* FIXME: zio-schema-json serializes default values + @Benchmark + def zioSchemaJson(): Array[Byte] = { + import com.github.plokhotnyuk.jsoniter_scala.benchmark.ZioSchemaJsonCodecs._ + import java.nio.charset.StandardCharsets.UTF_8 + + openRTBBidRequestCodec.encodeJson(obj, None).toString.getBytes(UTF_8) + } +*/ } \ No newline at end of file diff --git a/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/PrimitivesReading.scala b/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/PrimitivesReading.scala index 14b6eb24a..c66e5e40d 100644 --- a/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/PrimitivesReading.scala +++ b/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/PrimitivesReading.scala @@ -128,11 +128,18 @@ class PrimitivesReading extends PrimitivesBenchmark { @Benchmark def zioJson(): Primitives = { - import com.github.plokhotnyuk.jsoniter_scala.benchmark.ZioJSONEncoderDecoders._ - import zio.json._ - import zio.json.JsonDecoder._ + import com.github.plokhotnyuk.jsoniter_scala.benchmark.ZioJsonCodecs._ + import zio.json.DecoderOps import java.nio.charset.StandardCharsets.UTF_8 new String(jsonBytes, UTF_8).fromJson[Primitives].fold(sys.error, identity) } + + @Benchmark + def zioSchemaJson(): Primitives = { + import com.github.plokhotnyuk.jsoniter_scala.benchmark.ZioSchemaJsonCodecs._ + import java.nio.charset.StandardCharsets.UTF_8 + + primitivesCodec.decodeJson(new String(jsonBytes, UTF_8)).fold(sys.error, identity) + } } \ No newline at end of file diff --git a/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/PrimitivesWriting.scala b/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/PrimitivesWriting.scala index ba710baab..d842a3438 100644 --- a/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/PrimitivesWriting.scala +++ b/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/PrimitivesWriting.scala @@ -138,11 +138,18 @@ class PrimitivesWriting extends PrimitivesBenchmark { @Benchmark def zioJson(): Array[Byte] = { - import com.github.plokhotnyuk.jsoniter_scala.benchmark.ZioJSONEncoderDecoders._ - import zio.json._ - import zio.json.JsonEncoder._ + import com.github.plokhotnyuk.jsoniter_scala.benchmark.ZioJsonCodecs._ + import zio.json.EncoderOps import java.nio.charset.StandardCharsets.UTF_8 obj.toJson.getBytes(UTF_8) } + + @Benchmark + def zioSchemaJson(): Array[Byte] = { + import com.github.plokhotnyuk.jsoniter_scala.benchmark.ZioSchemaJsonCodecs._ + import java.nio.charset.StandardCharsets.UTF_8 + + primitivesCodec.encodeJson(obj, None).toString.getBytes(UTF_8) + } } \ No newline at end of file diff --git a/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/SetOfIntsWriting.scala b/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/SetOfIntsWriting.scala index 289778449..29fefdb5c 100644 --- a/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/SetOfIntsWriting.scala +++ b/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/SetOfIntsWriting.scala @@ -135,7 +135,7 @@ class SetOfIntsWriting extends SetOfIntsBenchmark { @Benchmark def zioJson(): Array[Byte] = { - import zio.json._ + import zio.json.EncoderOps import java.nio.charset.StandardCharsets.UTF_8 obj.toJson.getBytes(UTF_8) diff --git a/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/StringOfAsciiCharsWriting.scala b/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/StringOfAsciiCharsWriting.scala index 3cedc6f4f..5caa8e9c0 100644 --- a/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/StringOfAsciiCharsWriting.scala +++ b/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/StringOfAsciiCharsWriting.scala @@ -134,7 +134,7 @@ class StringOfAsciiCharsWriting extends StringOfAsciiCharsBenchmark { @Benchmark def zioJson(): Array[Byte] = { - import zio.json._ + import zio.json.EncoderOps import java.nio.charset.StandardCharsets.UTF_8 obj.toJson.getBytes(UTF_8) diff --git a/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/StringOfNonAsciiCharsWriting.scala b/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/StringOfNonAsciiCharsWriting.scala index 4e59ca397..ef5100ee3 100644 --- a/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/StringOfNonAsciiCharsWriting.scala +++ b/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/StringOfNonAsciiCharsWriting.scala @@ -134,7 +134,7 @@ class StringOfNonAsciiCharsWriting extends StringOfNonAsciiCharsBenchmark { @Benchmark def zioJson(): Array[Byte] = { - import zio.json._ + import zio.json.EncoderOps import java.nio.charset.StandardCharsets.UTF_8 obj.toJson.getBytes(UTF_8) diff --git a/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/TwitterAPIReading.scala b/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/TwitterAPIReading.scala index 43ddb8054..d4f34c38b 100644 --- a/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/TwitterAPIReading.scala +++ b/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/TwitterAPIReading.scala @@ -129,11 +129,18 @@ class TwitterAPIReading extends TwitterAPIBenchmark { @Benchmark def zioJson(): Seq[Tweet] = { - import com.github.plokhotnyuk.jsoniter_scala.benchmark.ZioJSONEncoderDecoders._ - import zio.json._ - import zio.json.JsonDecoder._ + import com.github.plokhotnyuk.jsoniter_scala.benchmark.ZioJsonCodecs._ + import zio.json.DecoderOps import java.nio.charset.StandardCharsets.UTF_8 new String(jsonBytes, UTF_8).fromJson[Seq[Tweet]].fold(sys.error, identity) } + + @Benchmark + def zioSchemaJson(): Seq[Tweet] = { + import com.github.plokhotnyuk.jsoniter_scala.benchmark.ZioSchemaJsonCodecs._ + import java.nio.charset.StandardCharsets.UTF_8 + + twitterAPICodec.decodeJson(new String(jsonBytes, UTF_8)).fold(sys.error, identity) + } } \ No newline at end of file diff --git a/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/TwitterAPIWriting.scala b/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/TwitterAPIWriting.scala index f7c8c86a8..e1f911073 100644 --- a/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/TwitterAPIWriting.scala +++ b/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/TwitterAPIWriting.scala @@ -138,15 +138,21 @@ class TwitterAPIWriting extends TwitterAPIBenchmark { FromScala(obj).transform(ToJson.bytes) } -/* FIXME: Zio-JSON serializes empty collections +/* FIXME: zio-json serializes empty collections @Benchmark def zioJson(): Array[Byte] = { - import com.github.plokhotnyuk.jsoniter_scala.benchmark.ZioJSONEncoderDecoders._ - import zio.json._ - import zio.json.JsonEncoder._ + import com.github.plokhotnyuk.jsoniter_scala.benchmark.ZioJsonCodecs._ + import zio.json.EncoderOps import java.nio.charset.StandardCharsets.UTF_8 obj.toJson.getBytes(UTF_8) } */ + @Benchmark + def zioSchemaJson(): Array[Byte] = { + import com.github.plokhotnyuk.jsoniter_scala.benchmark.ZioSchemaJsonCodecs._ + import java.nio.charset.StandardCharsets.UTF_8 + + twitterAPICodec.encodeJson(obj, None).toString.getBytes(UTF_8) + } } \ No newline at end of file diff --git a/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/VectorOfBooleansWriting.scala b/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/VectorOfBooleansWriting.scala index 8d0d4948d..b65b9d5ba 100644 --- a/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/VectorOfBooleansWriting.scala +++ b/jsoniter-scala-benchmark/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/VectorOfBooleansWriting.scala @@ -134,7 +134,7 @@ class VectorOfBooleansWriting extends VectorOfBooleansBenchmark { @Benchmark def zioJson(): Array[Byte] = { - import zio.json._ + import zio.json.EncoderOps import java.nio.charset.StandardCharsets.UTF_8 obj.toJson.getBytes(UTF_8) diff --git a/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ADTReading.scala b/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ADTReading.scala index 9902c269f..cd5ddaa39 100644 --- a/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ADTReading.scala +++ b/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ADTReading.scala @@ -114,11 +114,19 @@ class ADTReading extends ADTBenchmark { @Benchmark def zioJson(): ADTBase = { - import com.github.plokhotnyuk.jsoniter_scala.benchmark.ZioJSONEncoderDecoders._ - import zio.json._ - import zio.json.JsonDecoder._ + import com.github.plokhotnyuk.jsoniter_scala.benchmark.ZioJsonCodecs._ + import zio.json.DecoderOps import java.nio.charset.StandardCharsets.UTF_8 new String(jsonBytes, UTF_8).fromJson[ADTBase].fold(sys.error, identity) } +/* FIXME: zio-schema-json throws java.lang.RuntimeException: .type.Z.l.type(unrecognized subtype) + @Benchmark + def zioSchemaJson(): ADTBase = { + import com.github.plokhotnyuk.jsoniter_scala.benchmark.ZioSchemaJsonCodecs._ + import java.nio.charset.StandardCharsets.UTF_8 + + adtCodec.decodeJson(new String(jsonBytes, UTF_8)).fold(sys.error, identity) + } +*/ } \ No newline at end of file diff --git a/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ADTWriting.scala b/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ADTWriting.scala index 086ec216d..be4887fe2 100644 --- a/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ADTWriting.scala +++ b/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ADTWriting.scala @@ -122,11 +122,19 @@ class ADTWriting extends ADTBenchmark { @Benchmark def zioJson(): Array[Byte] = { - import com.github.plokhotnyuk.jsoniter_scala.benchmark.ZioJSONEncoderDecoders._ - import zio.json._ - import zio.json.JsonEncoder._ + import com.github.plokhotnyuk.jsoniter_scala.benchmark.ZioJsonCodecs._ + import zio.json.EncoderOps import java.nio.charset.StandardCharsets.UTF_8 obj.toJson.getBytes(UTF_8) } +/* FIXME: zio-schema-json doesn't serialize the discriminator field + @Benchmark + def zioSchemaJson(): Array[Byte] = { + import com.github.plokhotnyuk.jsoniter_scala.benchmark.ZioSchemaJsonCodecs._ + import java.nio.charset.StandardCharsets.UTF_8 + + adtCodec.encodeJson(obj, None).toString.getBytes(UTF_8) + } +*/ } \ No newline at end of file diff --git a/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/AnyValsReading.scala b/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/AnyValsReading.scala index ffa7ec486..2cc3b541e 100644 --- a/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/AnyValsReading.scala +++ b/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/AnyValsReading.scala @@ -114,11 +114,18 @@ class AnyValsReading extends AnyValsBenchmark { @Benchmark def zioJson(): AnyVals = { - import com.github.plokhotnyuk.jsoniter_scala.benchmark.ZioJSONEncoderDecoders._ - import zio.json._ - import zio.json.JsonDecoder._ + import com.github.plokhotnyuk.jsoniter_scala.benchmark.ZioJsonCodecs._ + import zio.json.DecoderOps import java.nio.charset.StandardCharsets.UTF_8 new String(jsonBytes, UTF_8).fromJson[AnyVals].fold(sys.error, identity) } + + @Benchmark + def zioSchemaJson(): AnyVals = { + import com.github.plokhotnyuk.jsoniter_scala.benchmark.ZioSchemaJsonCodecs._ + import java.nio.charset.StandardCharsets.UTF_8 + + anyValsCodec.decodeJson(new String(jsonBytes, UTF_8)).fold(sys.error, identity) + } } \ No newline at end of file diff --git a/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/AnyValsWriting.scala b/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/AnyValsWriting.scala index 3cd8de779..d8cf02774 100644 --- a/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/AnyValsWriting.scala +++ b/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/AnyValsWriting.scala @@ -122,11 +122,18 @@ class AnyValsWriting extends AnyValsBenchmark { @Benchmark def zioJson(): Array[Byte] = { - import com.github.plokhotnyuk.jsoniter_scala.benchmark.ZioJSONEncoderDecoders._ - import zio.json._ - import zio.json.JsonEncoder._ + import com.github.plokhotnyuk.jsoniter_scala.benchmark.ZioJsonCodecs._ + import zio.json.EncoderOps import java.nio.charset.StandardCharsets.UTF_8 obj.toJson.getBytes(UTF_8) } + + @Benchmark + def zioSchemaJson(): Array[Byte] = { + import com.github.plokhotnyuk.jsoniter_scala.benchmark.ZioSchemaJsonCodecs._ + import java.nio.charset.StandardCharsets.UTF_8 + + anyValsCodec.encodeJson(obj, None).toString.getBytes(UTF_8) + } } \ No newline at end of file diff --git a/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayBufferOfBooleansWriting.scala b/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayBufferOfBooleansWriting.scala index ac0595fb8..fab9b5140 100644 --- a/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayBufferOfBooleansWriting.scala +++ b/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayBufferOfBooleansWriting.scala @@ -111,7 +111,7 @@ class ArrayBufferOfBooleansWriting extends ArrayBufferOfBooleansBenchmark { @Benchmark def zioJson(): Array[Byte] = { - import zio.json._ + import zio.json.EncoderOps import java.nio.charset.StandardCharsets.UTF_8 obj.toJson.getBytes(UTF_8) diff --git a/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfBigDecimalsReading.scala b/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfBigDecimalsReading.scala index 5e93c8760..7eda44bda 100644 --- a/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfBigDecimalsReading.scala +++ b/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfBigDecimalsReading.scala @@ -112,7 +112,7 @@ class ArrayOfBigDecimalsReading extends ArrayOfBigDecimalsBenchmark { @Benchmark def zioJson(): Array[BigDecimal] = { - import zio.json._ + import zio.json.DecoderOps import java.nio.charset.StandardCharsets.UTF_8 new String(jsonBytes, UTF_8).fromJson[Array[BigDecimal]].fold(sys.error, identity) diff --git a/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfBigDecimalsWriting.scala b/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfBigDecimalsWriting.scala index 556ad6a16..12cce738c 100644 --- a/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfBigDecimalsWriting.scala +++ b/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfBigDecimalsWriting.scala @@ -120,7 +120,7 @@ class ArrayOfBigDecimalsWriting extends ArrayOfBigDecimalsBenchmark { */ @Benchmark def zioJson(): Array[Byte] = { - import zio.json._ + import zio.json.EncoderOps import java.nio.charset.StandardCharsets.UTF_8 obj.toJson.getBytes(UTF_8) diff --git a/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfBigIntsReading.scala b/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfBigIntsReading.scala index e9d1d60db..51ea1d118 100644 --- a/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfBigIntsReading.scala +++ b/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfBigIntsReading.scala @@ -114,7 +114,7 @@ class ArrayOfBigIntsReading extends ArrayOfBigIntsBenchmark { @Benchmark def zioJson(): Array[BigInt] = { - import zio.json._ + import zio.json.DecoderOps import java.nio.charset.StandardCharsets.UTF_8 new String(jsonBytes, UTF_8).fromJson[Array[BigInt]].fold(sys.error, identity) diff --git a/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfBigIntsWriting.scala b/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfBigIntsWriting.scala index 187087e73..a7cff66e5 100644 --- a/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfBigIntsWriting.scala +++ b/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfBigIntsWriting.scala @@ -121,7 +121,7 @@ class ArrayOfBigIntsWriting extends ArrayOfBigIntsBenchmark { */ @Benchmark def zioJson(): Array[Byte] = { - import zio.json._ + import zio.json.EncoderOps import java.nio.charset.StandardCharsets.UTF_8 obj.toJson.getBytes(UTF_8) diff --git a/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfBooleansWriting.scala b/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfBooleansWriting.scala index a37d90375..71127e2e5 100644 --- a/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfBooleansWriting.scala +++ b/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfBooleansWriting.scala @@ -120,7 +120,7 @@ class ArrayOfBooleansWriting extends ArrayOfBooleansBenchmark { @Benchmark def zioJson(): Array[Byte] = { - import zio.json._ + import zio.json.EncoderOps import java.nio.charset.StandardCharsets.UTF_8 obj.toJson.getBytes(UTF_8) diff --git a/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfBytesWriting.scala b/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfBytesWriting.scala index d99076d27..0b283045f 100644 --- a/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfBytesWriting.scala +++ b/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfBytesWriting.scala @@ -121,7 +121,7 @@ class ArrayOfBytesWriting extends ArrayOfBytesBenchmark { @Benchmark def zioJson(): Array[Byte] = { - import zio.json._ + import zio.json.EncoderOps import java.nio.charset.StandardCharsets.UTF_8 obj.toJson.getBytes(UTF_8) diff --git a/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfCharsWriting.scala b/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfCharsWriting.scala index 47cc3ded4..41143bab1 100644 --- a/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfCharsWriting.scala +++ b/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfCharsWriting.scala @@ -114,7 +114,7 @@ class ArrayOfCharsWriting extends ArrayOfCharsBenchmark { @Benchmark def zioJson(): Array[Byte] = { - import zio.json._ + import zio.json.EncoderOps import java.nio.charset.StandardCharsets.UTF_8 obj.toJson.getBytes(UTF_8) diff --git a/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfDoublesWriting.scala b/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfDoublesWriting.scala index ca9cb8acb..da5bdc87d 100644 --- a/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfDoublesWriting.scala +++ b/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfDoublesWriting.scala @@ -120,7 +120,7 @@ class ArrayOfDoublesWriting extends ArrayOfDoublesBenchmark { @Benchmark def zioJson(): Array[Byte] = { - import zio.json._ + import zio.json.EncoderOps import java.nio.charset.StandardCharsets.UTF_8 obj.toJson.getBytes(UTF_8) diff --git a/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfDurationsWriting.scala b/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfDurationsWriting.scala index a9df7ba90..9a3ad5e83 100644 --- a/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfDurationsWriting.scala +++ b/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfDurationsWriting.scala @@ -114,7 +114,7 @@ class ArrayOfDurationsWriting extends ArrayOfDurationsBenchmark { @Benchmark def zioJson(): Array[Byte] = { - import zio.json._ + import zio.json.EncoderOps import java.nio.charset.StandardCharsets.UTF_8 obj.toJson.getBytes(UTF_8) diff --git a/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfEnumADTsReading.scala b/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfEnumADTsReading.scala index 66d93289d..e9680e556 100644 --- a/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfEnumADTsReading.scala +++ b/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfEnumADTsReading.scala @@ -106,9 +106,8 @@ class ArrayOfEnumADTsReading extends ArrayOfEnumADTsBenchmark { @Benchmark def zioJson(): Array[SuitADT] = { - import com.github.plokhotnyuk.jsoniter_scala.benchmark.ZioJSONEncoderDecoders._ - import zio.json._ - import zio.json.JsonDecoder._ + import com.github.plokhotnyuk.jsoniter_scala.benchmark.ZioJsonCodecs._ + import zio.json.DecoderOps import java.nio.charset.StandardCharsets.UTF_8 new String(jsonBytes, UTF_8).fromJson[Array[SuitADT]].fold(sys.error, identity) diff --git a/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfEnumADTsWriting.scala b/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfEnumADTsWriting.scala index 275999710..48949eb81 100644 --- a/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfEnumADTsWriting.scala +++ b/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfEnumADTsWriting.scala @@ -114,9 +114,8 @@ class ArrayOfEnumADTsWriting extends ArrayOfEnumADTsBenchmark { @Benchmark def zioJson(): Array[Byte] = { - import com.github.plokhotnyuk.jsoniter_scala.benchmark.ZioJSONEncoderDecoders._ - import zio.json._ - import zio.json.JsonEncoder._ + import com.github.plokhotnyuk.jsoniter_scala.benchmark.ZioJsonCodecs._ + import zio.json.EncoderOps import java.nio.charset.StandardCharsets.UTF_8 obj.toJson.getBytes(UTF_8) diff --git a/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfEnumsReading.scala b/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfEnumsReading.scala index 98042a958..6f2fdc7db 100644 --- a/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfEnumsReading.scala +++ b/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfEnumsReading.scala @@ -107,9 +107,8 @@ class ArrayOfEnumsReading extends ArrayOfEnumsBenchmark { @Benchmark def zioJson(): Array[SuitEnum] = { - import com.github.plokhotnyuk.jsoniter_scala.benchmark.ZioJSONEncoderDecoders._ - import zio.json._ - import zio.json.JsonDecoder._ + import com.github.plokhotnyuk.jsoniter_scala.benchmark.ZioJsonCodecs._ + import zio.json.DecoderOps import java.nio.charset.StandardCharsets.UTF_8 new String(jsonBytes, UTF_8).fromJson[Array[SuitEnum]].fold(sys.error, identity) diff --git a/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfEnumsWriting.scala b/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfEnumsWriting.scala index 403281deb..47d8841d3 100644 --- a/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfEnumsWriting.scala +++ b/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfEnumsWriting.scala @@ -114,9 +114,8 @@ class ArrayOfEnumsWriting extends ArrayOfEnumsBenchmark { @Benchmark def zioJson(): Array[Byte] = { - import com.github.plokhotnyuk.jsoniter_scala.benchmark.ZioJSONEncoderDecoders._ - import zio.json._ - import zio.json.JsonEncoder._ + import com.github.plokhotnyuk.jsoniter_scala.benchmark.ZioJsonCodecs._ + import zio.json.EncoderOps import java.nio.charset.StandardCharsets.UTF_8 obj.toJson.getBytes(UTF_8) diff --git a/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfFloatsWriting.scala b/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfFloatsWriting.scala index 74a32df13..a32697c0d 100644 --- a/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfFloatsWriting.scala +++ b/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfFloatsWriting.scala @@ -120,7 +120,7 @@ class ArrayOfFloatsWriting extends ArrayOfFloatsBenchmark { @Benchmark def zioJson(): Array[Byte] = { - import zio.json._ + import zio.json.EncoderOps import java.nio.charset.StandardCharsets.UTF_8 obj.toJson.getBytes(UTF_8) diff --git a/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfInstantsWriting.scala b/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfInstantsWriting.scala index eaafc027b..e5b5c0498 100644 --- a/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfInstantsWriting.scala +++ b/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfInstantsWriting.scala @@ -122,7 +122,7 @@ class ArrayOfInstantsWriting extends ArrayOfInstantsBenchmark { @Benchmark def zioJson(): Array[Byte] = { - import zio.json._ + import zio.json.EncoderOps import java.nio.charset.StandardCharsets.UTF_8 obj.toJson.getBytes(UTF_8) diff --git a/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfIntsReading.scala b/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfIntsReading.scala index 8820da1e4..9e19e1235 100644 --- a/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfIntsReading.scala +++ b/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfIntsReading.scala @@ -111,7 +111,7 @@ class ArrayOfIntsReading extends ArrayOfIntsBenchmark { @Benchmark def zioJson(): Array[Int] = { - import zio.json._ + import zio.json.DecoderOps import java.nio.charset.StandardCharsets.UTF_8 new String(jsonBytes, UTF_8).fromJson[Array[Int]].fold(sys.error, identity) diff --git a/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfIntsWriting.scala b/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfIntsWriting.scala index 019e45922..5a4374688 100644 --- a/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfIntsWriting.scala +++ b/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfIntsWriting.scala @@ -120,7 +120,7 @@ class ArrayOfIntsWriting extends ArrayOfIntsBenchmark { @Benchmark def zioJson(): Array[Byte] = { - import zio.json._ + import zio.json.EncoderOps import java.nio.charset.StandardCharsets.UTF_8 obj.toJson.getBytes(UTF_8) diff --git a/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfLocalDateTimesWriting.scala b/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfLocalDateTimesWriting.scala index b87d7827d..11b812836 100644 --- a/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfLocalDateTimesWriting.scala +++ b/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfLocalDateTimesWriting.scala @@ -114,7 +114,7 @@ class ArrayOfLocalDateTimesWriting extends ArrayOfLocalDateTimesBenchmark { @Benchmark def zioJson(): Array[Byte] = { - import zio.json._ + import zio.json.EncoderOps import java.nio.charset.StandardCharsets.UTF_8 obj.toJson.getBytes(UTF_8) diff --git a/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfLocalDatesWriting.scala b/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfLocalDatesWriting.scala index 0b6451e44..3d293ec9b 100644 --- a/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfLocalDatesWriting.scala +++ b/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfLocalDatesWriting.scala @@ -114,7 +114,7 @@ class ArrayOfLocalDatesWriting extends ArrayOfLocalDatesBenchmark { @Benchmark def zioJson(): Array[Byte] = { - import zio.json._ + import zio.json.EncoderOps import java.nio.charset.StandardCharsets.UTF_8 obj.toJson.getBytes(UTF_8) diff --git a/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfLocalTimesWriting.scala b/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfLocalTimesWriting.scala index 35c5def85..a203c0555 100644 --- a/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfLocalTimesWriting.scala +++ b/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfLocalTimesWriting.scala @@ -114,7 +114,7 @@ class ArrayOfLocalTimesWriting extends ArrayOfLocalTimesBenchmark { @Benchmark def zioJson(): Array[Byte] = { - import zio.json._ + import zio.json.EncoderOps import java.nio.charset.StandardCharsets.UTF_8 obj.toJson.getBytes(UTF_8) diff --git a/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfLongsWriting.scala b/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfLongsWriting.scala index aea0c278f..6e0220c4c 100644 --- a/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfLongsWriting.scala +++ b/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfLongsWriting.scala @@ -120,7 +120,7 @@ class ArrayOfLongsWriting extends ArrayOfLongsBenchmark { @Benchmark def zioJson(): Array[Byte] = { - import zio.json._ + import zio.json.EncoderOps import java.nio.charset.StandardCharsets.UTF_8 obj.toJson.getBytes(UTF_8) diff --git a/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfMonthDaysWriting.scala b/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfMonthDaysWriting.scala index 4b0e1889b..e93635d3f 100644 --- a/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfMonthDaysWriting.scala +++ b/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfMonthDaysWriting.scala @@ -114,7 +114,7 @@ class ArrayOfMonthDaysWriting extends ArrayOfMonthDaysBenchmark { @Benchmark def zioJson(): Array[Byte] = { - import zio.json._ + import zio.json.EncoderOps import java.nio.charset.StandardCharsets.UTF_8 obj.toJson.getBytes(UTF_8) diff --git a/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfOffsetDateTimesWriting.scala b/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfOffsetDateTimesWriting.scala index 3b65b8e7f..f22db1984 100644 --- a/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfOffsetDateTimesWriting.scala +++ b/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfOffsetDateTimesWriting.scala @@ -114,7 +114,7 @@ class ArrayOfOffsetDateTimesWriting extends ArrayOfOffsetDateTimesBenchmark { @Benchmark def zioJson(): Array[Byte] = { - import zio.json._ + import zio.json.EncoderOps import java.nio.charset.StandardCharsets.UTF_8 obj.toJson.getBytes(UTF_8) diff --git a/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfOffsetTimesWriting.scala b/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfOffsetTimesWriting.scala index e9fb47a05..e8ed6cf75 100644 --- a/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfOffsetTimesWriting.scala +++ b/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfOffsetTimesWriting.scala @@ -114,7 +114,7 @@ class ArrayOfOffsetTimesWriting extends ArrayOfOffsetTimesBenchmark { @Benchmark def zioJson(): Array[Byte] = { - import zio.json._ + import zio.json.EncoderOps import java.nio.charset.StandardCharsets.UTF_8 obj.toJson.getBytes(UTF_8) diff --git a/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfPeriodsWriting.scala b/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfPeriodsWriting.scala index 3d2405d68..75b463ed4 100644 --- a/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfPeriodsWriting.scala +++ b/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfPeriodsWriting.scala @@ -114,7 +114,7 @@ class ArrayOfPeriodsWriting extends ArrayOfPeriodsBenchmark { @Benchmark def zioJson(): Array[Byte] = { - import zio.json._ + import zio.json.EncoderOps import java.nio.charset.StandardCharsets.UTF_8 obj.toJson.getBytes(UTF_8) diff --git a/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfShortsReading.scala b/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfShortsReading.scala index 66d65f8f7..8ab20221f 100644 --- a/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfShortsReading.scala +++ b/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfShortsReading.scala @@ -111,7 +111,7 @@ class ArrayOfShortsReading extends ArrayOfShortsBenchmark { @Benchmark def zioJson(): Array[Short] = { - import zio.json._ + import zio.json.DecoderOps import java.nio.charset.StandardCharsets.UTF_8 new String(jsonBytes, UTF_8).fromJson[Array[Short]].fold(sys.error, identity) diff --git a/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfShortsWriting.scala b/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfShortsWriting.scala index b9dcba3f0..3f5f7bdaa 100644 --- a/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfShortsWriting.scala +++ b/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfShortsWriting.scala @@ -120,7 +120,7 @@ class ArrayOfShortsWriting extends ArrayOfShortsBenchmark { @Benchmark def zioJson(): Array[Byte] = { - import zio.json._ + import zio.json.EncoderOps import java.nio.charset.StandardCharsets.UTF_8 obj.toJson.getBytes(UTF_8) diff --git a/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfUUIDsWriting.scala b/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfUUIDsWriting.scala index 5c105f1ee..aa03ac953 100644 --- a/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfUUIDsWriting.scala +++ b/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfUUIDsWriting.scala @@ -120,7 +120,7 @@ class ArrayOfUUIDsWriting extends ArrayOfUUIDsBenchmark { @Benchmark def zioJson(): Array[Byte] = { - import zio.json._ + import zio.json.EncoderOps import java.nio.charset.StandardCharsets.UTF_8 obj.toJson.getBytes(UTF_8) diff --git a/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfYearMonthsWriting.scala b/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfYearMonthsWriting.scala index c2bf6571f..3232dddaa 100644 --- a/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfYearMonthsWriting.scala +++ b/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfYearMonthsWriting.scala @@ -114,7 +114,7 @@ class ArrayOfYearMonthsWriting extends ArrayOfYearMonthsBenchmark { @Benchmark def zioJson(): Array[Byte] = { - import zio.json._ + import zio.json.EncoderOps import java.nio.charset.StandardCharsets.UTF_8 obj.toJson.getBytes(UTF_8) diff --git a/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfYearsWriting.scala b/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfYearsWriting.scala index 13c3eef23..3c67104ed 100644 --- a/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfYearsWriting.scala +++ b/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfYearsWriting.scala @@ -114,7 +114,7 @@ class ArrayOfYearsWriting extends ArrayOfYearsBenchmark { @Benchmark def zioJson(): Array[Byte] = { - import zio.json._ + import zio.json.EncoderOps import java.nio.charset.StandardCharsets.UTF_8 obj.toJson.getBytes(UTF_8) diff --git a/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfZoneIdsWriting.scala b/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfZoneIdsWriting.scala index e1dd07239..11ab86ea2 100644 --- a/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfZoneIdsWriting.scala +++ b/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfZoneIdsWriting.scala @@ -114,7 +114,7 @@ class ArrayOfZoneIdsWriting extends ArrayOfZoneIdsBenchmark { @Benchmark def zioJson(): Array[Byte] = { - import zio.json._ + import zio.json.EncoderOps import java.nio.charset.StandardCharsets.UTF_8 obj.toJson.getBytes(UTF_8) diff --git a/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfZoneOffsetsWriting.scala b/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfZoneOffsetsWriting.scala index 6f4bc2c2d..1d6fe0652 100644 --- a/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfZoneOffsetsWriting.scala +++ b/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfZoneOffsetsWriting.scala @@ -114,7 +114,7 @@ class ArrayOfZoneOffsetsWriting extends ArrayOfZoneOffsetsBenchmark { @Benchmark def zioJson(): Array[Byte] = { - import zio.json._ + import zio.json.EncoderOps import java.nio.charset.StandardCharsets.UTF_8 obj.toJson.getBytes(UTF_8) diff --git a/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfZonedDateTimesWriting.scala b/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfZonedDateTimesWriting.scala index 6b7f3cdf3..0c5c4c480 100644 --- a/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfZonedDateTimesWriting.scala +++ b/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArrayOfZonedDateTimesWriting.scala @@ -114,7 +114,7 @@ class ArrayOfZonedDateTimesWriting extends ArrayOfZonedDateTimesBenchmark { @Benchmark def zioJson(): Array[Byte] = { - import zio.json._ + import zio.json.EncoderOps import java.nio.charset.StandardCharsets.UTF_8 obj.toJson.getBytes(UTF_8) diff --git a/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArraySeqOfBooleansReading.scala b/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArraySeqOfBooleansReading.scala index 1bcfd5d82..98e667cc7 100644 --- a/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArraySeqOfBooleansReading.scala +++ b/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArraySeqOfBooleansReading.scala @@ -112,9 +112,9 @@ class ArraySeqOfBooleansReading extends ArraySeqOfBooleansBenchmark { @Benchmark def zioJson(): ArraySeq[Boolean] = { + import com.github.plokhotnyuk.jsoniter_scala.benchmark.ZioJsonCodecs._ import zio.json.DecoderOps import java.nio.charset.StandardCharsets.UTF_8 - import com.github.plokhotnyuk.jsoniter_scala.benchmark.ZioJSONEncoderDecoders._ new String(jsonBytes, UTF_8).fromJson[ArraySeq[Boolean]].fold(sys.error, identity) } diff --git a/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArraySeqOfBooleansWriting.scala b/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArraySeqOfBooleansWriting.scala index 33fd10ba3..1ec97626e 100644 --- a/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArraySeqOfBooleansWriting.scala +++ b/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ArraySeqOfBooleansWriting.scala @@ -119,7 +119,7 @@ class ArraySeqOfBooleansWriting extends ArraySeqOfBooleansBenchmark { @Benchmark def zioJson(): Array[Byte] = { - import zio.json._ + import zio.json.EncoderOps import java.nio.charset.StandardCharsets.UTF_8 obj.toJson.getBytes(UTF_8) diff --git a/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/Base64Reading.scala b/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/Base64Reading.scala index e05d03485..99b576bdc 100644 --- a/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/Base64Reading.scala +++ b/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/Base64Reading.scala @@ -114,8 +114,8 @@ class Base64Reading extends Base64Benchmark { @Benchmark def zioJson(): Array[Byte] = { - import com.github.plokhotnyuk.jsoniter_scala.benchmark.ZioJSONEncoderDecoders._ - import zio.json._ + import com.github.plokhotnyuk.jsoniter_scala.benchmark.ZioJsonCodecs._ + import zio.json.DecoderOps import java.nio.charset.StandardCharsets.UTF_8 new String(jsonBytes, UTF_8).fromJson[Array[Byte]](base64C3c.decoder).fold(sys.error, identity) diff --git a/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/Base64Writing.scala b/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/Base64Writing.scala index 4f5ae0fbc..c8ba43494 100644 --- a/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/Base64Writing.scala +++ b/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/Base64Writing.scala @@ -121,8 +121,8 @@ class Base64Writing extends Base64Benchmark { @Benchmark def zioJson(): Array[Byte] = { - import com.github.plokhotnyuk.jsoniter_scala.benchmark.ZioJSONEncoderDecoders._ - import zio.json._ + import com.github.plokhotnyuk.jsoniter_scala.benchmark.ZioJsonCodecs._ + import zio.json.EncoderOps import java.nio.charset.StandardCharsets.UTF_8 obj.toJson(base64C3c.encoder).getBytes(UTF_8) diff --git a/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/BigDecimalWriting.scala b/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/BigDecimalWriting.scala index ec6c0b865..bde36665d 100644 --- a/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/BigDecimalWriting.scala +++ b/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/BigDecimalWriting.scala @@ -120,7 +120,7 @@ class BigDecimalWriting extends BigDecimalBenchmark { */ @Benchmark def zioJson(): Array[Byte] = { - import zio.json._ + import zio.json.EncoderOps import java.nio.charset.StandardCharsets.UTF_8 obj.toJson.getBytes(UTF_8) diff --git a/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/BigIntWriting.scala b/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/BigIntWriting.scala index 76a0974bc..4730e7d09 100644 --- a/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/BigIntWriting.scala +++ b/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/BigIntWriting.scala @@ -120,7 +120,7 @@ class BigIntWriting extends BigIntBenchmark { */ @Benchmark def zioJson(): Array[Byte] = { - import zio.json._ + import zio.json.EncoderOps import java.nio.charset.StandardCharsets.UTF_8 obj.toJson.getBytes(UTF_8) diff --git a/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ExtractFieldsReading.scala b/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ExtractFieldsReading.scala index ca2a82191..19eac0ae1 100644 --- a/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ExtractFieldsReading.scala +++ b/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ExtractFieldsReading.scala @@ -114,11 +114,18 @@ class ExtractFieldsReading extends ExtractFieldsBenchmark { @Benchmark def zioJson(): ExtractFields = { - import com.github.plokhotnyuk.jsoniter_scala.benchmark.ZioJSONEncoderDecoders._ - import zio.json._ - import zio.json.JsonDecoder._ + import com.github.plokhotnyuk.jsoniter_scala.benchmark.ZioJsonCodecs._ + import zio.json.DecoderOps import java.nio.charset.StandardCharsets.UTF_8 new String(jsonBytes, UTF_8).fromJson[ExtractFields].fold(sys.error, identity) } + + @Benchmark + def zioSchemaJson(): ExtractFields = { + import com.github.plokhotnyuk.jsoniter_scala.benchmark.ZioSchemaJsonCodecs._ + import java.nio.charset.StandardCharsets.UTF_8 + + extractFieldsCodec.decodeJson(new String(jsonBytes, UTF_8)).fold(sys.error, identity) + } } \ No newline at end of file diff --git a/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/GeoJSONReading.scala b/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/GeoJSONReading.scala index 8761dc0ed..a6e6108c4 100644 --- a/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/GeoJSONReading.scala +++ b/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/GeoJSONReading.scala @@ -115,11 +115,19 @@ class GeoJSONReading extends GeoJSONBenchmark { @Benchmark def zioJson(): GeoJSON = { - import com.github.plokhotnyuk.jsoniter_scala.benchmark.ZioJSONEncoderDecoders._ - import zio.json._ - import zio.json.JsonDecoder._ + import com.github.plokhotnyuk.jsoniter_scala.benchmark.ZioJsonCodecs._ + import zio.json.DecoderOps import java.nio.charset.StandardCharsets.UTF_8 new String(jsonBytes, UTF_8).fromJson[GeoJSON].fold(sys.error, identity) } +/* FIXME: zio-schema-json throws java.lang.RuntimeException: .type.FeatureCollection.features[0].type.Feature.geometry.type.Polygon(unrecognized subtype) + @Benchmark + def zioSchemaJson(): GeoJSON = { + import com.github.plokhotnyuk.jsoniter_scala.benchmark.ZioSchemaJsonCodecs._ + import java.nio.charset.StandardCharsets.UTF_8 + + geoJSONCodec.decodeJson(new String(jsonBytes, UTF_8)).fold(sys.error, identity) + } +*/ } \ No newline at end of file diff --git a/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/GeoJSONWriting.scala b/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/GeoJSONWriting.scala index 44d479b12..952567726 100644 --- a/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/GeoJSONWriting.scala +++ b/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/GeoJSONWriting.scala @@ -123,11 +123,18 @@ class GeoJSONWriting extends GeoJSONBenchmark { @Benchmark def zioJson(): Array[Byte] = { - import com.github.plokhotnyuk.jsoniter_scala.benchmark.ZioJSONEncoderDecoders._ - import zio.json._ - import zio.json.JsonEncoder._ + import com.github.plokhotnyuk.jsoniter_scala.benchmark.ZioJsonCodecs._ + import zio.json.EncoderOps import java.nio.charset.StandardCharsets.UTF_8 obj.toJson.getBytes(UTF_8) } + + @Benchmark + def zioSchemaJson(): Array[Byte] = { + import com.github.plokhotnyuk.jsoniter_scala.benchmark.ZioSchemaJsonCodecs._ + import java.nio.charset.StandardCharsets.UTF_8 + + geoJsonCodec.encodeJson(obj, None).toString.getBytes(UTF_8) + } } \ No newline at end of file diff --git a/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/GitHubActionsAPIReading.scala b/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/GitHubActionsAPIReading.scala index 3588fec3b..0f9177c73 100644 --- a/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/GitHubActionsAPIReading.scala +++ b/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/GitHubActionsAPIReading.scala @@ -114,11 +114,18 @@ class GitHubActionsAPIReading extends GitHubActionsAPIBenchmark { @Benchmark def zioJson(): GitHubActionsAPI.Response = { - import com.github.plokhotnyuk.jsoniter_scala.benchmark.ZioJSONEncoderDecoders._ - import zio.json._ - import zio.json.JsonDecoder._ + import com.github.plokhotnyuk.jsoniter_scala.benchmark.ZioJsonCodecs._ + import zio.json.DecoderOps import java.nio.charset.StandardCharsets.UTF_8 new String(jsonBytes, UTF_8).fromJson[GitHubActionsAPI.Response].fold(sys.error, identity) } + + @Benchmark + def zioSchemaJson(): GitHubActionsAPI.Response = { + import com.github.plokhotnyuk.jsoniter_scala.benchmark.ZioSchemaJsonCodecs._ + import java.nio.charset.StandardCharsets.UTF_8 + + gitHubActionsAPICodec.decodeJson(new String(jsonBytes, UTF_8)).fold(sys.error, identity) + } } \ No newline at end of file diff --git a/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/GitHubActionsAPIWriting.scala b/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/GitHubActionsAPIWriting.scala index 1fe195b86..6a033f325 100644 --- a/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/GitHubActionsAPIWriting.scala +++ b/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/GitHubActionsAPIWriting.scala @@ -122,11 +122,18 @@ class GitHubActionsAPIWriting extends GitHubActionsAPIBenchmark { @Benchmark def zioJson(): Array[Byte] = { - import com.github.plokhotnyuk.jsoniter_scala.benchmark.ZioJSONEncoderDecoders._ - import zio.json._ - import zio.json.JsonEncoder._ + import com.github.plokhotnyuk.jsoniter_scala.benchmark.ZioJsonCodecs._ + import zio.json.EncoderOps import java.nio.charset.StandardCharsets.UTF_8 obj.toJson.getBytes(UTF_8) } + + @Benchmark + def zioSchemaJson(): Array[Byte] = { + import com.github.plokhotnyuk.jsoniter_scala.benchmark.ZioSchemaJsonCodecs._ + import java.nio.charset.StandardCharsets.UTF_8 + + gitHubActionsAPICodec.encodeJson(obj, None).toString.getBytes(UTF_8) + } } \ No newline at end of file diff --git a/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/GoogleMapsAPIPrettyPrinting.scala b/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/GoogleMapsAPIPrettyPrinting.scala index fdd615444..a87eecabe 100644 --- a/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/GoogleMapsAPIPrettyPrinting.scala +++ b/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/GoogleMapsAPIPrettyPrinting.scala @@ -124,10 +124,18 @@ class GoogleMapsAPIPrettyPrinting extends GoogleMapsAPIBenchmark { @Benchmark def zioJson(): Array[Byte] = { - import com.github.plokhotnyuk.jsoniter_scala.benchmark.ZioJSONEncoderDecoders._ + import com.github.plokhotnyuk.jsoniter_scala.benchmark.ZioJsonCodecs._ import zio.json._ import java.nio.charset.StandardCharsets.UTF_8 obj.toJsonPretty.getBytes(UTF_8) } + + @Benchmark + def zioSchemaJson(): Array[Byte] = { + import com.github.plokhotnyuk.jsoniter_scala.benchmark.ZioSchemaJsonCodecs._ + import java.nio.charset.StandardCharsets.UTF_8 + + googleMapsAPICodec.encodeJson(obj, new Some(0)).toString.getBytes(UTF_8) + } } \ No newline at end of file diff --git a/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/GoogleMapsAPIReading.scala b/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/GoogleMapsAPIReading.scala index 43881e063..8a3d19d8d 100644 --- a/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/GoogleMapsAPIReading.scala +++ b/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/GoogleMapsAPIReading.scala @@ -115,11 +115,18 @@ class GoogleMapsAPIReading extends GoogleMapsAPIBenchmark { @Benchmark def zioJson(): DistanceMatrix = { - import com.github.plokhotnyuk.jsoniter_scala.benchmark.ZioJSONEncoderDecoders._ - import zio.json._ - import zio.json.JsonDecoder._ + import com.github.plokhotnyuk.jsoniter_scala.benchmark.ZioJsonCodecs._ + import zio.json.DecoderOps import java.nio.charset.StandardCharsets.UTF_8 new String(jsonBytes, UTF_8).fromJson[DistanceMatrix].fold(sys.error, identity) } + + @Benchmark + def zioSchemaJson(): DistanceMatrix = { + import com.github.plokhotnyuk.jsoniter_scala.benchmark.ZioSchemaJsonCodecs._ + import java.nio.charset.StandardCharsets.UTF_8 + + googleMapsAPICodec.decodeJson(new String(jsonBytes, UTF_8)).fold(sys.error, identity) + } } \ No newline at end of file diff --git a/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/GoogleMapsAPIWriting.scala b/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/GoogleMapsAPIWriting.scala index b190cc8f0..f8621f5e5 100644 --- a/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/GoogleMapsAPIWriting.scala +++ b/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/GoogleMapsAPIWriting.scala @@ -122,11 +122,18 @@ class GoogleMapsAPIWriting extends GoogleMapsAPIBenchmark { @Benchmark def zioJson(): Array[Byte] = { - import com.github.plokhotnyuk.jsoniter_scala.benchmark.ZioJSONEncoderDecoders._ - import zio.json._ - import zio.json.JsonEncoder._ + import com.github.plokhotnyuk.jsoniter_scala.benchmark.ZioJsonCodecs._ + import zio.json.EncoderOps import java.nio.charset.StandardCharsets.UTF_8 obj.toJson.getBytes(UTF_8) } + + @Benchmark + def zioSchemaJson(): Array[Byte] = { + import com.github.plokhotnyuk.jsoniter_scala.benchmark.ZioSchemaJsonCodecs._ + import java.nio.charset.StandardCharsets.UTF_8 + + googleMapsAPICodec.encodeJson(obj, None).toString.getBytes(UTF_8) + } } \ No newline at end of file diff --git a/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/IntWriting.scala b/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/IntWriting.scala index 017349791..985cc5489 100644 --- a/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/IntWriting.scala +++ b/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/IntWriting.scala @@ -120,7 +120,7 @@ class IntWriting extends IntBenchmark { @Benchmark def zioJson(): Array[Byte] = { - import zio.json._ + import zio.json.EncoderOps import java.nio.charset.StandardCharsets.UTF_8 obj.toJson.getBytes(UTF_8) diff --git a/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ListOfBooleansWriting.scala b/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ListOfBooleansWriting.scala index 4e69ca787..4ae03a6fc 100644 --- a/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ListOfBooleansWriting.scala +++ b/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/ListOfBooleansWriting.scala @@ -119,7 +119,7 @@ class ListOfBooleansWriting extends ListOfBooleansBenchmark { @Benchmark def zioJson(): Array[Byte] = { - import zio.json._ + import zio.json.EncoderOps import java.nio.charset.StandardCharsets.UTF_8 obj.toJson.getBytes(UTF_8) diff --git a/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/MapOfIntsToBooleansReading.scala b/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/MapOfIntsToBooleansReading.scala index e906d21b4..d27c421b8 100644 --- a/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/MapOfIntsToBooleansReading.scala +++ b/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/MapOfIntsToBooleansReading.scala @@ -103,7 +103,7 @@ class MapOfIntsToBooleansReading extends MapOfIntsToBooleansBenchmark { @Benchmark def zioJson(): Map[Int, Boolean] = { - import zio.json._ + import zio.json.DecoderOps import java.nio.charset.StandardCharsets.UTF_8 new String(jsonBytes, UTF_8).fromJson[Map[Int, Boolean]].fold(sys.error, identity) diff --git a/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/MapOfIntsToBooleansWriting.scala b/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/MapOfIntsToBooleansWriting.scala index fc4355f53..3b99dd9e4 100644 --- a/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/MapOfIntsToBooleansWriting.scala +++ b/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/MapOfIntsToBooleansWriting.scala @@ -111,7 +111,7 @@ class MapOfIntsToBooleansWriting extends MapOfIntsToBooleansBenchmark { @Benchmark def zioJson(): Array[Byte] = { - import zio.json._ + import zio.json.EncoderOps import java.nio.charset.StandardCharsets.UTF_8 obj.toJson.getBytes(UTF_8) diff --git a/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/MissingRequiredFieldsReading.scala b/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/MissingRequiredFieldsReading.scala index d1e5dd519..56c07f073 100644 --- a/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/MissingRequiredFieldsReading.scala +++ b/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/MissingRequiredFieldsReading.scala @@ -189,11 +189,18 @@ class MissingRequiredFieldsReading extends MissingRequiredFieldsBenchmark { @Benchmark def zioJson(): String = { - import com.github.plokhotnyuk.jsoniter_scala.benchmark.ZioJSONEncoderDecoders._ - import zio.json._ - import zio.json.JsonDecoder._ + import com.github.plokhotnyuk.jsoniter_scala.benchmark.ZioJsonCodecs._ + import zio.json.DecoderOps import java.nio.charset.StandardCharsets.UTF_8 new String(jsonBytes, UTF_8).fromJson[MissingRequiredFields].fold(identity, _.toString) // toString shouldn't be called } + + @Benchmark + def zioSchemaJson(): String = { + import com.github.plokhotnyuk.jsoniter_scala.benchmark.ZioSchemaJsonCodecs._ + import java.nio.charset.StandardCharsets.UTF_8 + + missingRequiredFieldsCodec.decodeJson(new String(jsonBytes, UTF_8)).fold(identity, _.toString) // toString shouldn't be called + } } \ No newline at end of file diff --git a/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/MutableMapOfIntsToBooleansWriting.scala b/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/MutableMapOfIntsToBooleansWriting.scala index c801e78f3..7774364dc 100644 --- a/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/MutableMapOfIntsToBooleansWriting.scala +++ b/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/MutableMapOfIntsToBooleansWriting.scala @@ -95,7 +95,7 @@ class MutableMapOfIntsToBooleansWriting extends MutableMapOfIntsToBooleansBenchm @Benchmark def zioJson(): Array[Byte] = { - import zio.json._ + import zio.json.EncoderOps import java.nio.charset.StandardCharsets.UTF_8 obj.toJson.getBytes(UTF_8) diff --git a/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/MutableSetOfIntsWriting.scala b/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/MutableSetOfIntsWriting.scala index 39e1b0520..3042074b8 100644 --- a/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/MutableSetOfIntsWriting.scala +++ b/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/MutableSetOfIntsWriting.scala @@ -102,7 +102,7 @@ class MutableSetOfIntsWriting extends MutableSetOfIntsBenchmark { @Benchmark def zioJson(): Array[Byte] = { - import zio.json._ + import zio.json.EncoderOps import java.nio.charset.StandardCharsets.UTF_8 obj.toJson.getBytes(UTF_8) diff --git a/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/NestedStructsReading.scala b/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/NestedStructsReading.scala index 2410aa3ca..ceb596570 100644 --- a/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/NestedStructsReading.scala +++ b/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/NestedStructsReading.scala @@ -115,11 +115,19 @@ class NestedStructsReading extends NestedStructsBenchmark { @Benchmark def zioJson(): NestedStructs = { - import zio.json._ - import zio.json.JsonDecoder._ - import com.github.plokhotnyuk.jsoniter_scala.benchmark.ZioJSONEncoderDecoders._ + import com.github.plokhotnyuk.jsoniter_scala.benchmark.ZioJsonCodecs._ + import zio.json.DecoderOps import java.nio.charset.StandardCharsets.UTF_8 new String(jsonBytes, UTF_8).fromJson[NestedStructs].fold(sys.error, identity) } +/* FIXME: zio-schema-json parses only 127 levels of nesting instead of 128 + @Benchmark + def zioSchemaJson(): NestedStructs = { + import com.github.plokhotnyuk.jsoniter_scala.benchmark.ZioSchemaJsonCodecs._ + import java.nio.charset.StandardCharsets.UTF_8 + + nestedStructsCodec.decodeJson(new String(jsonBytes, UTF_8)).fold(sys.error, identity) + } +*/ } \ No newline at end of file diff --git a/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/NestedStructsWriting.scala b/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/NestedStructsWriting.scala index 4b8a664b6..05cdb5649 100644 --- a/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/NestedStructsWriting.scala +++ b/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/NestedStructsWriting.scala @@ -123,11 +123,18 @@ class NestedStructsWriting extends NestedStructsBenchmark { @Benchmark def zioJson(): Array[Byte] = { - import com.github.plokhotnyuk.jsoniter_scala.benchmark.ZioJSONEncoderDecoders._ - import zio.json._ - import zio.json.JsonEncoder._ + import com.github.plokhotnyuk.jsoniter_scala.benchmark.ZioJsonCodecs._ + import zio.json.EncoderOps import java.nio.charset.StandardCharsets.UTF_8 obj.toJson.getBytes(UTF_8) } + + @Benchmark + def zioSchemaJson(): Array[Byte] = { + import com.github.plokhotnyuk.jsoniter_scala.benchmark.ZioSchemaJsonCodecs._ + import java.nio.charset.StandardCharsets.UTF_8 + + nestedStructsCodec.encodeJson(obj, None).toString.getBytes(UTF_8) + } } \ No newline at end of file diff --git a/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/OpenRTBReading.scala b/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/OpenRTBReading.scala index 1a5e09e20..652738e33 100644 --- a/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/OpenRTBReading.scala +++ b/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/OpenRTBReading.scala @@ -116,10 +116,18 @@ class OpenRTBReading extends OpenRTBBenchmark { @Benchmark def zioJson(): BidRequest = { - import com.github.plokhotnyuk.jsoniter_scala.benchmark.ZioJSONEncoderDecoders._ - import zio.json._ + import com.github.plokhotnyuk.jsoniter_scala.benchmark.ZioJsonCodecs._ + import zio.json.DecoderOps import java.nio.charset.StandardCharsets.UTF_8 new String(jsonBytes, UTF_8).fromJson[BidRequest].fold(sys.error, identity) } + + @Benchmark + def zioSchemaJson(): BidRequest = { + import com.github.plokhotnyuk.jsoniter_scala.benchmark.ZioSchemaJsonCodecs._ + import java.nio.charset.StandardCharsets.UTF_8 + + openRTBBidRequestCodec.decodeJson(new String(jsonBytes, UTF_8)).fold(sys.error, identity) + } } \ No newline at end of file diff --git a/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/OpenRTBWriting.scala b/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/OpenRTBWriting.scala index 06bbd6116..ff1ae1079 100644 --- a/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/OpenRTBWriting.scala +++ b/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/OpenRTBWriting.scala @@ -120,15 +120,23 @@ class OpenRTBWriting extends OpenRTBBenchmark { FromScala(obj).transform(ToJson.bytes) } -/* FIXME: Zio-JSON serializes empty collections +/* FIXME: zio-json serializes empty collections @Benchmark def zioJson(): Array[Byte] = { - import com.github.plokhotnyuk.jsoniter_scala.benchmark.ZioJSONEncoderDecoders._ - import zio.json._ - import zio.json.JsonEncoder._ + import com.github.plokhotnyuk.jsoniter_scala.benchmark.ZioJsonCodecs._ + import zio.json.EncoderOps import java.nio.charset.StandardCharsets.UTF_8 obj.toJson.getBytes(UTF_8) } */ +/* FIXME: zio-schema-json serializes default values + @Benchmark + def zioSchemaJson(): Array[Byte] = { + import com.github.plokhotnyuk.jsoniter_scala.benchmark.ZioSchemaJsonCodecs._ + import java.nio.charset.StandardCharsets.UTF_8 + + openRTBBidRequestCodec.encodeJson(obj, None).toString.getBytes(UTF_8) + } +*/ } \ No newline at end of file diff --git a/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/PrimitivesReading.scala b/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/PrimitivesReading.scala index 990cf4a2f..ff5db5317 100644 --- a/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/PrimitivesReading.scala +++ b/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/PrimitivesReading.scala @@ -114,11 +114,18 @@ class PrimitivesReading extends PrimitivesBenchmark { @Benchmark def zioJson(): Primitives = { - import com.github.plokhotnyuk.jsoniter_scala.benchmark.ZioJSONEncoderDecoders._ - import zio.json._ - import zio.json.JsonDecoder._ + import com.github.plokhotnyuk.jsoniter_scala.benchmark.ZioJsonCodecs._ + import zio.json.DecoderOps import java.nio.charset.StandardCharsets.UTF_8 new String(jsonBytes, UTF_8).fromJson[Primitives].fold(sys.error, identity) } + + @Benchmark + def zioSchemaJson(): Primitives = { + import com.github.plokhotnyuk.jsoniter_scala.benchmark.ZioSchemaJsonCodecs._ + import java.nio.charset.StandardCharsets.UTF_8 + + primitivesCodec.decodeJson(new String(jsonBytes, UTF_8)).fold(sys.error, identity) + } } \ No newline at end of file diff --git a/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/PrimitivesWriting.scala b/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/PrimitivesWriting.scala index c2ea7dc4d..b02b0d7e3 100644 --- a/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/PrimitivesWriting.scala +++ b/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/PrimitivesWriting.scala @@ -122,11 +122,18 @@ class PrimitivesWriting extends PrimitivesBenchmark { @Benchmark def zioJson(): Array[Byte] = { - import com.github.plokhotnyuk.jsoniter_scala.benchmark.ZioJSONEncoderDecoders._ - import zio.json._ - import zio.json.JsonEncoder._ + import com.github.plokhotnyuk.jsoniter_scala.benchmark.ZioJsonCodecs._ + import zio.json.EncoderOps import java.nio.charset.StandardCharsets.UTF_8 obj.toJson.getBytes(UTF_8) } + + @Benchmark + def zioSchemaJson(): Array[Byte] = { + import com.github.plokhotnyuk.jsoniter_scala.benchmark.ZioSchemaJsonCodecs._ + import java.nio.charset.StandardCharsets.UTF_8 + + primitivesCodec.encodeJson(obj, None).toString.getBytes(UTF_8) + } } \ No newline at end of file diff --git a/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/SetOfIntsWriting.scala b/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/SetOfIntsWriting.scala index e9c1ba900..bfcb4b9be 100644 --- a/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/SetOfIntsWriting.scala +++ b/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/SetOfIntsWriting.scala @@ -120,7 +120,7 @@ class SetOfIntsWriting extends SetOfIntsBenchmark { @Benchmark def zioJson(): Array[Byte] = { - import zio.json._ + import zio.json.EncoderOps import java.nio.charset.StandardCharsets.UTF_8 obj.toJson.getBytes(UTF_8) diff --git a/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/StringOfAsciiCharsWriting.scala b/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/StringOfAsciiCharsWriting.scala index 6b2360bf0..258dbb97f 100644 --- a/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/StringOfAsciiCharsWriting.scala +++ b/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/StringOfAsciiCharsWriting.scala @@ -119,7 +119,7 @@ class StringOfAsciiCharsWriting extends StringOfAsciiCharsBenchmark { @Benchmark def zioJson(): Array[Byte] = { - import zio.json._ + import zio.json.EncoderOps import java.nio.charset.StandardCharsets.UTF_8 obj.toJson.getBytes(UTF_8) diff --git a/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/StringOfNonAsciiCharsWriting.scala b/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/StringOfNonAsciiCharsWriting.scala index 80b6df1c2..90f438e57 100644 --- a/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/StringOfNonAsciiCharsWriting.scala +++ b/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/StringOfNonAsciiCharsWriting.scala @@ -119,7 +119,7 @@ class StringOfNonAsciiCharsWriting extends StringOfNonAsciiCharsBenchmark { @Benchmark def zioJson(): Array[Byte] = { - import zio.json._ + import zio.json.EncoderOps import java.nio.charset.StandardCharsets.UTF_8 obj.toJson.getBytes(UTF_8) diff --git a/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/TwitterAPIReading.scala b/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/TwitterAPIReading.scala index 7b91090f5..61d0a7761 100644 --- a/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/TwitterAPIReading.scala +++ b/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/TwitterAPIReading.scala @@ -116,11 +116,18 @@ class TwitterAPIReading extends TwitterAPIBenchmark { @Benchmark def zioJson(): Seq[Tweet] = { - import com.github.plokhotnyuk.jsoniter_scala.benchmark.ZioJSONEncoderDecoders._ - import zio.json._ - import zio.json.JsonDecoder._ + import com.github.plokhotnyuk.jsoniter_scala.benchmark.ZioJsonCodecs._ + import zio.json.DecoderOps import java.nio.charset.StandardCharsets.UTF_8 new String(jsonBytes, UTF_8).fromJson[Seq[Tweet]].fold(sys.error, identity) } + + @Benchmark + def zioSchemaJson(): Seq[Tweet] = { + import com.github.plokhotnyuk.jsoniter_scala.benchmark.ZioSchemaJsonCodecs._ + import java.nio.charset.StandardCharsets.UTF_8 + + twitterAPICodec.decodeJson(new String(jsonBytes, UTF_8)).fold(sys.error, identity) + } } \ No newline at end of file diff --git a/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/TwitterAPIWriting.scala b/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/TwitterAPIWriting.scala index b41579cf0..03c124c1c 100644 --- a/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/TwitterAPIWriting.scala +++ b/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/TwitterAPIWriting.scala @@ -122,15 +122,21 @@ class TwitterAPIWriting extends TwitterAPIBenchmark { FromScala(obj).transform(ToJson.bytes) } -/* FIXME: Zio-JSON serializes empty collections +/* FIXME: zio-json serializes empty collections @Benchmark def zioJson(): Array[Byte] = { - import com.github.plokhotnyuk.jsoniter_scala.benchmark.ZioJSONEncoderDecoders._ - import zio.json._ - import zio.json.JsonEncoder._ + import com.github.plokhotnyuk.jsoniter_scala.benchmark.ZioJsonCodecs._ + import zio.json.EncoderOps import java.nio.charset.StandardCharsets.UTF_8 obj.toJson.getBytes(UTF_8) } */ + @Benchmark + def zioSchemaJson(): Array[Byte] = { + import com.github.plokhotnyuk.jsoniter_scala.benchmark.ZioSchemaJsonCodecs._ + import java.nio.charset.StandardCharsets.UTF_8 + + twitterAPICodec.encodeJson(obj, None).toString.getBytes(UTF_8) + } } \ No newline at end of file diff --git a/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/VectorOfBooleansWriting.scala b/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/VectorOfBooleansWriting.scala index 1eb29b00d..085dd48f0 100644 --- a/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/VectorOfBooleansWriting.scala +++ b/jsoniter-scala-benchmark/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/VectorOfBooleansWriting.scala @@ -119,7 +119,7 @@ class VectorOfBooleansWriting extends VectorOfBooleansBenchmark { @Benchmark def zioJson(): Array[Byte] = { - import zio.json._ + import zio.json.EncoderOps import java.nio.charset.StandardCharsets.UTF_8 obj.toJson.getBytes(UTF_8) diff --git a/jsoniter-scala-benchmark/shared/src/main/scala/com/github/plokhotnyuk/jsoniter_scala/benchmark/ZioJSONEncoderDecoders.scala b/jsoniter-scala-benchmark/shared/src/main/scala/com/github/plokhotnyuk/jsoniter_scala/benchmark/ZioJsonCodecs.scala similarity index 99% rename from jsoniter-scala-benchmark/shared/src/main/scala/com/github/plokhotnyuk/jsoniter_scala/benchmark/ZioJSONEncoderDecoders.scala rename to jsoniter-scala-benchmark/shared/src/main/scala/com/github/plokhotnyuk/jsoniter_scala/benchmark/ZioJsonCodecs.scala index b1f03c58a..e6057450e 100644 --- a/jsoniter-scala-benchmark/shared/src/main/scala/com/github/plokhotnyuk/jsoniter_scala/benchmark/ZioJSONEncoderDecoders.scala +++ b/jsoniter-scala-benchmark/shared/src/main/scala/com/github/plokhotnyuk/jsoniter_scala/benchmark/ZioJsonCodecs.scala @@ -8,7 +8,7 @@ import java.util.Base64 import scala.collection.immutable.ArraySeq import scala.reflect.ClassTag -object ZioJSONEncoderDecoders { +object ZioJsonCodecs { implicit val adtC3c: JsonCodec[ADTBase] = DeriveJsonCodec.gen implicit val geoJsonC3c: JsonCodec[GeoJSON.GeoJSON] = { implicit val c1: JsonCodec[GeoJSON.SimpleGeometry] = DeriveJsonCodec.gen diff --git a/jsoniter-scala-benchmark/shared/src/main/scala/com/github/plokhotnyuk/jsoniter_scala/benchmark/ZioSchemaJsonCodecs.scala b/jsoniter-scala-benchmark/shared/src/main/scala/com/github/plokhotnyuk/jsoniter_scala/benchmark/ZioSchemaJsonCodecs.scala new file mode 100644 index 000000000..6e0c06774 --- /dev/null +++ b/jsoniter-scala-benchmark/shared/src/main/scala/com/github/plokhotnyuk/jsoniter_scala/benchmark/ZioSchemaJsonCodecs.scala @@ -0,0 +1,90 @@ +package com.github.plokhotnyuk.jsoniter_scala.benchmark + +import zio.Chunk +import zio.json.JsonCodec +import zio.schema.StandardType +import zio.schema.annotation._ +import zio.schema.{DeriveSchema, Schema} + +object ZioSchemaJsonCodecs { + implicit def indexedSeq[A](implicit codec: Schema[A]): Schema[IndexedSeq[A]] = + Schema.chunk[A].transform(_.toIndexedSeq, Chunk.fromIterable) + + implicit def seq[A](implicit codec: Schema[A]): Schema[Seq[A]] = + Schema.chunk[A].transform(_.toSeq, Chunk.fromIterable) + + val adtCodec: JsonCodec[ADTBase] = + zio.schema.codec.JsonCodec.jsonCodec(DeriveSchema.gen[ADTBase].annotate(discriminatorName("type"))) + val anyValsCodec: JsonCodec[AnyVals] = { + implicit val s1: Schema[ByteVal] = Schema.Primitive(StandardType.ByteType).transform(ByteVal.apply, _.a) + implicit val s2: Schema[ShortVal] = Schema.Primitive(StandardType.ShortType).transform(ShortVal.apply, _.a) + implicit val s3: Schema[IntVal] = Schema.Primitive(StandardType.IntType).transform(IntVal.apply, _.a) + implicit val s4: Schema[LongVal] = Schema.Primitive(StandardType.LongType).transform(LongVal.apply, _.a) + implicit val s5: Schema[BooleanVal] = Schema.Primitive(StandardType.BoolType).transform(BooleanVal.apply, _.a) + implicit val s6: Schema[CharVal] = Schema.Primitive(StandardType.CharType).transform(CharVal.apply, _.a) + implicit val s7: Schema[DoubleVal] = Schema.Primitive(StandardType.DoubleType).transform(DoubleVal.apply, _.a) + implicit val s8: Schema[FloatVal] = Schema.Primitive(StandardType.FloatType).transform(FloatVal.apply, _.a) + zio.schema.codec.JsonCodec.jsonCodec(DeriveSchema.gen[AnyVals]) + } + val extractFieldsCodec: JsonCodec[ExtractFields] = + zio.schema.codec.JsonCodec.jsonCodec(DeriveSchema.gen[ExtractFields]) + val geoJsonCodec: JsonCodec[GeoJSON.GeoJSON] = { + implicit val s1: Schema[(Double, Double)] = Schema.tuple2[Double, Double] + implicit val s2: Schema[GeoJSON.SimpleGeometry] = DeriveSchema.gen[GeoJSON.SimpleGeometry].annotate(discriminatorName("type")) + implicit val s3: Schema[GeoJSON.Geometry] = DeriveSchema.gen[GeoJSON.Geometry].annotate(discriminatorName("type")) + implicit val s4: Schema[GeoJSON.SimpleGeoJSON] = DeriveSchema.gen[GeoJSON.SimpleGeoJSON].annotate(discriminatorName("type")) + zio.schema.codec.JsonCodec.jsonCodec(DeriveSchema.gen[GeoJSON.GeoJSON].annotate(discriminatorName("type"))) + } + val gitHubActionsAPICodec: JsonCodec[GitHubActionsAPI.Response] = { + implicit val s1: Schema[Boolean] = Schema.primitive[String].transform(_.toBoolean, _.toString) + implicit val s2: Schema[GitHubActionsAPI.Artifact] = DeriveSchema.gen + zio.schema.codec.JsonCodec.jsonCodec(DeriveSchema.gen[GitHubActionsAPI.Response]) + } + val googleMapsAPICodec: JsonCodec[GoogleMapsAPI.DistanceMatrix] = { + implicit val s1: Schema[GoogleMapsAPI.Value] = DeriveSchema.gen + implicit val s2: Schema[GoogleMapsAPI.Elements] = DeriveSchema.gen + implicit val s3: Schema[GoogleMapsAPI.Rows] = DeriveSchema.gen + zio.schema.codec.JsonCodec.jsonCodec(DeriveSchema.gen[GoogleMapsAPI.DistanceMatrix]) + } + val nestedStructsCodec: JsonCodec[NestedStructs] = + zio.schema.codec.JsonCodec.jsonCodec(DeriveSchema.gen[NestedStructs]) + val missingRequiredFieldsCodec: JsonCodec[MissingRequiredFields] = + zio.schema.codec.JsonCodec.jsonCodec(DeriveSchema.gen[MissingRequiredFields]) + val openRTBBidRequestCodec: JsonCodec[OpenRTB.BidRequest] = { + implicit val s1: Schema[OpenRTB.Segment] = DeriveSchema.gen + implicit val s2: Schema[OpenRTB.Format] = DeriveSchema.gen + implicit val s3: Schema[OpenRTB.Deal] = DeriveSchema.gen + implicit val s4: Schema[OpenRTB.Metric] = DeriveSchema.gen + implicit val s5: Schema[OpenRTB.Banner] = DeriveSchema.gen + implicit val s6: Schema[OpenRTB.Audio] = DeriveSchema.gen + implicit val s7: Schema[OpenRTB.Video] = DeriveSchema.gen + implicit val s8: Schema[OpenRTB.Native] = DeriveSchema.gen + implicit val s9: Schema[OpenRTB.Pmp] = DeriveSchema.gen + implicit val s10: Schema[OpenRTB.Producer] = DeriveSchema.gen + implicit val s11: Schema[OpenRTB.Data] = DeriveSchema.gen + implicit val s12: Schema[OpenRTB.Content] = DeriveSchema.gen + implicit val s13: Schema[OpenRTB.Publisher] = DeriveSchema.gen + implicit val s14: Schema[OpenRTB.Geo] = DeriveSchema.gen + implicit val s15: Schema[OpenRTB.Imp] = DeriveSchema.gen + implicit val s16: Schema[OpenRTB.Site] = DeriveSchema.gen + implicit val s17: Schema[OpenRTB.App] = DeriveSchema.gen + implicit val s18: Schema[OpenRTB.Device] = DeriveSchema.gen + implicit val s19: Schema[OpenRTB.User] = DeriveSchema.gen + implicit val s20: Schema[OpenRTB.Source] = DeriveSchema.gen + implicit val s21: Schema[OpenRTB.Reqs] = DeriveSchema.gen + zio.schema.codec.JsonCodec.jsonCodec(DeriveSchema.gen[OpenRTB.BidRequest]) + } + val primitivesCodec: JsonCodec[Primitives] = + zio.schema.codec.JsonCodec.jsonCodec(DeriveSchema.gen[Primitives]) + val twitterAPICodec: JsonCodec[Seq[TwitterAPI.Tweet]] = { + implicit val s1: Schema[TwitterAPI.UserMentions] = DeriveSchema.gen + implicit val s2: Schema[TwitterAPI.Urls] = DeriveSchema.gen + implicit val s3: Schema[TwitterAPI.Entities] = DeriveSchema.gen + implicit val s4: Schema[TwitterAPI.Url] = DeriveSchema.gen + implicit val s5: Schema[TwitterAPI.UserEntities] = DeriveSchema.gen + implicit val s6: Schema[TwitterAPI.User] = DeriveSchema.gen + implicit val s7: Schema[TwitterAPI.RetweetedStatus] = DeriveSchema.gen + implicit val s8: Schema[TwitterAPI.Tweet] = DeriveSchema.gen + zio.schema.codec.JsonCodec.jsonCodec(seq[TwitterAPI.Tweet]) + } +} \ No newline at end of file