Skip to content

Commit 4f767ae

Browse files
committed
Add zio-json benchmarks for parsing BigDecimal and BigInt values with an arbitrary length
1 parent 558b3dd commit 4f767ae

File tree

15 files changed

+112
-34
lines changed

15 files changed

+112
-34
lines changed

jsoniter-scala-benchmark/js/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/Main.scala

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1014,7 +1014,8 @@ object Main {
10141014
B("circe")(benchmark.circe()),
10151015
B("circeJsoniter")(benchmark.circeJsoniter()),
10161016
B("jsoniterScala")(benchmark.jsoniterScala()),
1017-
B("uPickle")(benchmark.uPickle())
1017+
B("uPickle")(benchmark.uPickle()),
1018+
B("zioJson")(benchmark.zioJson())
10181019
))
10191020
}, {
10201021
val benchmark = new BigDecimalWriting { size = 128; setup() }
@@ -1040,7 +1041,8 @@ object Main {
10401041
B("circeJsoniter")(benchmark.circeJsoniter()),
10411042
B("jsoniterScala")(benchmark.jsoniterScala()),
10421043
B("smithy4sJson")(benchmark.smithy4sJson()),
1043-
B("uPickle")(benchmark.uPickle())
1044+
B("uPickle")(benchmark.uPickle()),
1045+
B("zioJson")(benchmark.zioJson())
10441046
))
10451047
}, {
10461048
val benchmark = new BigIntWriting { size = 128; setup() }

jsoniter-scala-benchmark/js/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/Main.scala

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -943,7 +943,8 @@ object Main {
943943
B("circe")(benchmark.circe()),
944944
B("circeJsoniter")(benchmark.circeJsoniter()),
945945
B("jsoniterScala")(benchmark.jsoniterScala()),
946-
B("uPickle")(benchmark.uPickle())
946+
B("uPickle")(benchmark.uPickle()),
947+
B("zioJson")(benchmark.zioJson())
947948
))
948949
}, {
949950
val benchmark = new BigDecimalWriting { size = 128; setup() }
@@ -967,7 +968,8 @@ object Main {
967968
B("circeJsoniter")(benchmark.circeJsoniter()),
968969
B("jsoniterScala")(benchmark.jsoniterScala()),
969970
B("smithy4sJson")(benchmark.smithy4sJson()),
970-
B("uPickle")(benchmark.uPickle())
971+
B("uPickle")(benchmark.uPickle()),
972+
B("zioJson")(benchmark.zioJson())
971973
))
972974
}, {
973975
val benchmark = new BigIntWriting { size = 128; setup() }

jsoniter-scala-benchmark/js/src/test/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/BigDecimalReadingSpec.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ class BigDecimalReadingSpec extends BenchmarkSpecBase {
1919
//FIXME: smithy4sJson: don't know how to tune precision for parsing of BigDecimal values
2020
//benchmark.smithy4sJson() shouldBe benchmark.sourceObj
2121
benchmark.uPickle() shouldBe benchmark.sourceObj
22+
benchmark.zioJson() shouldBe benchmark.sourceObj
2223
}
2324
"fail on invalid input" in {
2425
val b = benchmark
@@ -29,6 +30,7 @@ class BigDecimalReadingSpec extends BenchmarkSpecBase {
2930
intercept[Throwable](b.circeJsoniter())
3031
intercept[Throwable](b.jsoniterScala())
3132
intercept[Throwable](b.uPickle())
33+
intercept[Throwable](b.zioJson())
3234
}
3335
}
3436
}

jsoniter-scala-benchmark/js/src/test/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/BigIntReadingSpec.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ class BigIntReadingSpec extends BenchmarkSpecBase {
1818
//benchmark.playJson() shouldBe benchmark.obj
1919
benchmark.smithy4sJson() shouldBe benchmark.obj
2020
benchmark.uPickle() shouldBe benchmark.obj
21+
benchmark.zioJson() shouldBe benchmark.obj
2122
}
2223
"fail on invalid input" in {
2324
val b = benchmark
@@ -29,6 +30,7 @@ class BigIntReadingSpec extends BenchmarkSpecBase {
2930
intercept[Throwable](b.jsoniterScala())
3031
intercept[Throwable](b.smithy4sJson())
3132
intercept[Throwable](b.uPickle())
33+
intercept[Throwable](b.zioJson())
3234
}
3335
}
3436
}

jsoniter-scala-benchmark/js/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/BigDecimalReadingSpec.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ class BigDecimalReadingSpec extends BenchmarkSpecBase {
1818
//FIXME: smithy4sJson: don't know how to tune precision for parsing of BigDecimal values
1919
//benchmark.smithy4sJson() shouldBe benchmark.sourceObj
2020
benchmark.uPickle() shouldBe benchmark.sourceObj
21+
benchmark.zioJson() shouldBe benchmark.sourceObj
2122
}
2223
"fail on invalid input" in {
2324
val b = benchmark
@@ -27,6 +28,7 @@ class BigDecimalReadingSpec extends BenchmarkSpecBase {
2728
intercept[Throwable](b.circeJsoniter())
2829
intercept[Throwable](b.jsoniterScala())
2930
intercept[Throwable](b.uPickle())
31+
intercept[Throwable](b.zioJson())
3032
}
3133
}
3234
}

jsoniter-scala-benchmark/js/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/BigIntReadingSpec.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ class BigIntReadingSpec extends BenchmarkSpecBase {
1717
//benchmark.playJson() shouldBe benchmark.obj
1818
benchmark.smithy4sJson() shouldBe benchmark.obj
1919
benchmark.uPickle() shouldBe benchmark.obj
20+
benchmark.zioJson() shouldBe benchmark.obj
2021
}
2122
"fail on invalid input" in {
2223
val b = benchmark
@@ -27,6 +28,7 @@ class BigIntReadingSpec extends BenchmarkSpecBase {
2728
intercept[Throwable](b.jsoniterScala())
2829
intercept[Throwable](b.smithy4sJson())
2930
intercept[Throwable](b.uPickle())
31+
intercept[Throwable](b.zioJson())
3032
}
3133
}
3234
}

jsoniter-scala-benchmark/jvm/src/test/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/BigDecimalReadingSpec.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ class BigDecimalReadingSpec extends BenchmarkSpecBase {
2626
benchmark.sprayJson() shouldBe benchmark.sourceObj
2727
benchmark.uPickle() shouldBe benchmark.sourceObj
2828
benchmark.weePickle() shouldBe benchmark.sourceObj
29+
benchmark.zioJson() shouldBe benchmark.sourceObj
2930
}
3031
"fail on invalid input" in {
3132
val b = benchmark
@@ -43,6 +44,7 @@ class BigDecimalReadingSpec extends BenchmarkSpecBase {
4344
intercept[Throwable](b.sprayJson())
4445
intercept[Throwable](b.uPickle())
4546
intercept[Throwable](b.weePickle())
47+
intercept[Throwable](b.zioJson())
4648
}
4749
}
4850
}

jsoniter-scala-benchmark/jvm/src/test/scala-2/com/github/plokhotnyuk/jsoniter_scala/benchmark/BigIntReadingSpec.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ class BigIntReadingSpec extends BenchmarkSpecBase {
2525
benchmark.sprayJson() shouldBe benchmark.obj
2626
benchmark.uPickle() shouldBe benchmark.obj
2727
benchmark.weePickle() shouldBe benchmark.obj
28+
benchmark.zioJson() shouldBe benchmark.obj
2829
}
2930
"fail on invalid input" in {
3031
val b = benchmark
@@ -43,6 +44,7 @@ class BigIntReadingSpec extends BenchmarkSpecBase {
4344
intercept[Throwable](b.sprayJson())
4445
intercept[Throwable](b.uPickle())
4546
intercept[Throwable](b.weePickle())
47+
intercept[Throwable](b.zioJson())
4648
}
4749
}
4850
}

jsoniter-scala-benchmark/jvm/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/BigDecimalReadingSpec.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ class BigDecimalReadingSpec extends BenchmarkSpecBase {
2424
benchmark.sprayJson() shouldBe benchmark.sourceObj
2525
benchmark.uPickle() shouldBe benchmark.sourceObj
2626
benchmark.weePickle() shouldBe benchmark.sourceObj
27+
benchmark.zioJson() shouldBe benchmark.sourceObj
2728
}
2829
"fail on invalid input" in {
2930
val b = benchmark
@@ -39,6 +40,7 @@ class BigDecimalReadingSpec extends BenchmarkSpecBase {
3940
intercept[Throwable](b.sprayJson())
4041
intercept[Throwable](b.uPickle())
4142
intercept[Throwable](b.weePickle())
43+
intercept[Throwable](b.zioJson())
4244
}
4345
}
4446
}

jsoniter-scala-benchmark/jvm/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/benchmark/BigIntReadingSpec.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ class BigIntReadingSpec extends BenchmarkSpecBase {
2323
benchmark.sprayJson() shouldBe benchmark.obj
2424
benchmark.uPickle() shouldBe benchmark.obj
2525
benchmark.weePickle() shouldBe benchmark.obj
26+
benchmark.zioJson() shouldBe benchmark.obj
2627
}
2728
"fail on invalid input" in {
2829
val b = benchmark
@@ -39,6 +40,7 @@ class BigIntReadingSpec extends BenchmarkSpecBase {
3940
intercept[Throwable](b.sprayJson())
4041
intercept[Throwable](b.uPickle())
4142
intercept[Throwable](b.weePickle())
43+
intercept[Throwable](b.zioJson())
4244
}
4345
}
4446
}

0 commit comments

Comments
 (0)