Skip to content

Commit

Permalink
Add benchmarks for zio-schema-json
Browse files Browse the repository at this point in the history
  • Loading branch information
plokhotnyuk committed Jan 5, 2025
1 parent 375a831 commit 41214b0
Show file tree
Hide file tree
Showing 230 changed files with 892 additions and 288 deletions.
1 change: 1 addition & 0 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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() }
Expand All @@ -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() }
Expand All @@ -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() }
Expand All @@ -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() }
Expand Down Expand Up @@ -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() }
Expand All @@ -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() }
Expand All @@ -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() }
Expand All @@ -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() }
Expand All @@ -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() }
Expand All @@ -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() }
Expand All @@ -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() }
Expand All @@ -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() }
Expand Down Expand Up @@ -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() }
Expand Down Expand Up @@ -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() }
Expand All @@ -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() }
Expand All @@ -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() }
Expand All @@ -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() }
Expand All @@ -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() }
Expand All @@ -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() }
Expand Down Expand Up @@ -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() }
Expand All @@ -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() }
Expand Down
Loading

0 comments on commit 41214b0

Please sign in to comment.