File tree Expand file tree Collapse file tree 3 files changed +45
-5
lines changed
core/shared/src/test/scala Expand file tree Collapse file tree 3 files changed +45
-5
lines changed Original file line number Diff line number Diff line change 11-J-XX:+UseG1GC
2- -J-Xmx2G
2+ -J-Xmx4G
Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ import cats.syntax.all._
2020
2121import org .openjdk .jmh .annotations .{Benchmark , BenchmarkMode , Mode }
2222import cats .data .NonEmptyList
23-
23+ import scala . jdk . CollectionConverters . _
2424import schemas ._
2525import data ._
2626
@@ -31,6 +31,30 @@ class EncodingBench {
3131 def encodeAnS =
3232 Schema .string.write(string)
3333
34+ @ Benchmark
35+ @ BenchmarkMode (Array (Mode .Throughput ))
36+ def encodeRawAnM =
37+ DynamoValue .m(
38+ Map (
39+ " name" -> DynamoValue .s(allosaurus.name),
40+ " age" -> DynamoValue .n(allosaurus.age),
41+ " attacks" -> DynamoValue .n(allosaurus.attacks)
42+ )
43+ )
44+
45+ @ Benchmark
46+ @ BenchmarkMode (Array (Mode .Throughput ))
47+ def encodeRawAnMAsAv =
48+ val map = new java.util.IdentityHashMap [String , software.amazon.awssdk.services.dynamodb.model.AttributeValue ](3 )
49+ map.put(" name" , software.amazon.awssdk.services.dynamodb.model.AttributeValue .builder().s(allosaurus.name).build())
50+ map.put(" age" , software.amazon.awssdk.services.dynamodb.model.AttributeValue .builder().n(allosaurus.age.toString).build())
51+ map.put(" attacks" , software.amazon.awssdk.services.dynamodb.model.AttributeValue .builder().n(allosaurus.attacks.toString).build())
52+ DynamoValue (software.amazon.awssdk.services.dynamodb.model.AttributeValue
53+ .builder()
54+ .m(map)
55+ .build()
56+ )
57+
3458 @ Benchmark
3559 @ BenchmarkMode (Array (Mode .Throughput ))
3660 def encodeAnM =
Original file line number Diff line number Diff line change @@ -615,9 +615,25 @@ class SchemaSuite extends ScalaCheckSuite {
615615 check(schema, departments, expected)
616616 }
617617
618- test(" recursive products with higly recursive" ) {
619- val departments = deepDepartment(1 , 3 )
620- val expected = deepDepartmentDynamoValue(1 , 3 );
618+ test(" recursive products with very deep record" ) {
619+ val departments = deepDepartment(100 , 1 )
620+ val expected = deepDepartmentDynamoValue(100 , 1 );
621+
622+ val schema : Schema [Department ] = Schema .recursive { rec =>
623+ Schema .record { field =>
624+ (
625+ field(" name" , _.name),
626+ field(" subdeps" , _.subdeps)(rec.asList)
627+ ).mapN(Department .apply)
628+ }
629+ }
630+
631+ check(schema, departments, expected)
632+ }
633+
634+ test(" recursive products with very wide record" .only) {
635+ val departments = deepDepartment(1 , 100 )
636+ val expected = deepDepartmentDynamoValue(1 , 100 );
621637
622638 val schema : Schema [Department ] = Schema .recursive { rec =>
623639 Schema .record { field =>
You can’t perform that action at this time.
0 commit comments