Skip to content

Commit 967340f

Browse files
committed
Review comments
1 parent 8113a10 commit 967340f

File tree

4 files changed

+15
-76
lines changed

4 files changed

+15
-76
lines changed

test/sdk-benchmarks/pom.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@
137137
<dependency>
138138
<groupId>software.amazon.awssdk</groupId>
139139
<artifactId>dynamodb-enhanced</artifactId>
140+
<!-- TODO: Remove '-PREVIEW' when the client is GA -->
140141
<version>${awsjavasdk.version}-PREVIEW</version>
141142
</dependency>
142143
<dependency>

test/sdk-benchmarks/src/main/java/software/amazon/awssdk/benchmark/enhanced/dynamodb/EnhancedClientGetOverheadBenchmark.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,12 +78,12 @@ public class EnhancedClientGetOverheadBenchmark {
7878

7979

8080
@Benchmark
81-
public Object llGet(TestState s) {
81+
public Object lowLevelGet(TestState s) {
8282
return s.dynamoDb.getItem(GetItemRequest.builder().build());
8383
}
8484

8585
@Benchmark
86-
public Object enhGet(TestState s) {
86+
public Object enhanceGet(TestState s) {
8787
return s.table.getItem(testKey);
8888
}
8989

test/sdk-benchmarks/src/main/java/software/amazon/awssdk/benchmark/enhanced/dynamodb/EnhancedClientPutOverheadBenchmark.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,12 @@
4646
@State(Scope.Benchmark)
4747
public class EnhancedClientPutOverheadBenchmark {
4848
@Benchmark
49-
public void llPut(TestState s) {
49+
public void lowLevelPut(TestState s) {
5050
s.ddb.putItem(r -> r.item(s.testItem.av));
5151
}
5252

5353
@Benchmark
54-
public void enhPut(TestState s) {
54+
public void enhancedPut(TestState s) {
5555
s.enhTable.putItem(s.testItem.bean);
5656
}
5757

test/sdk-benchmarks/src/main/java/software/amazon/awssdk/benchmark/enhanced/dynamodb/ItemFactory.java

Lines changed: 10 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323
import java.util.List;
2424
import java.util.Map;
2525
import java.util.Random;
26+
import java.util.stream.Collectors;
27+
import java.util.stream.IntStream;
2628
import software.amazon.awssdk.core.SdkBytes;
2729

2830
abstract class ItemFactory<T> {
@@ -65,40 +67,7 @@ public final HugeBean hugeBean() {
6567
b.setHashKey(randomS());
6668
b.setStringAttr(randomS());
6769
b.setBinaryAttr(randomBytes());
68-
b.setListAttr(Arrays.asList(randomS(),
69-
randomS(),
70-
randomS(),
71-
72-
randomS(),
73-
randomS(),
74-
randomS(),
75-
randomS(),
76-
77-
randomS(),
78-
randomS(),
79-
randomS(),
80-
randomS(),
81-
randomS(),
82-
randomS(),
83-
randomS(),
84-
randomS(),
85-
86-
randomS(),
87-
randomS(),
88-
randomS(),
89-
randomS(),
90-
randomS(),
91-
randomS(),
92-
randomS(),
93-
randomS(),
94-
randomS(),
95-
randomS(),
96-
randomS(),
97-
randomS(),
98-
randomS(),
99-
randomS(),
100-
randomS(),
101-
randomS()));
70+
b.setListAttr(IntStream.range(0, 32).mapToObj(i -> randomS()).collect(Collectors.toList()));
10271

10372
Map<String, SdkBytes> mapAttr1 = new HashMap<>();
10473
mapAttr1.put("key1", randomBytes());
@@ -109,40 +78,10 @@ public final HugeBean hugeBean() {
10978

11079
Map<String, List<SdkBytes>> mapAttr2 = new HashMap<>();
11180
mapAttr2.put("key1", Arrays.asList(randomBytes()));
112-
mapAttr2.put("key2", Arrays.asList(
113-
randomBytes(),
114-
randomBytes()));
115-
mapAttr2.put("key3", Arrays.asList(
116-
randomBytes(),
117-
randomBytes(),
118-
randomBytes(),
119-
randomBytes()));
120-
mapAttr2.put("key4", Arrays.asList(
121-
randomBytes(),
122-
randomBytes(),
123-
randomBytes(),
124-
randomBytes(),
125-
randomBytes(),
126-
randomBytes(),
127-
randomBytes(),
128-
randomBytes()));
129-
mapAttr2.put("key5", Arrays.asList(
130-
randomBytes(),
131-
randomBytes(),
132-
randomBytes(),
133-
randomBytes(),
134-
randomBytes(),
135-
randomBytes(),
136-
randomBytes(),
137-
randomBytes(),
138-
randomBytes(),
139-
randomBytes(),
140-
randomBytes(),
141-
randomBytes(),
142-
randomBytes(),
143-
randomBytes(),
144-
randomBytes(),
145-
randomBytes()));
81+
mapAttr2.put("key2", IntStream.range(0, 2).mapToObj(i -> randomBytes()).collect(Collectors.toList()));
82+
mapAttr2.put("key3", IntStream.range(0, 4).mapToObj(i -> randomBytes()).collect(Collectors.toList()));
83+
mapAttr2.put("key4", IntStream.range(0, 8).mapToObj(i -> randomBytes()).collect(Collectors.toList()));
84+
mapAttr2.put("key5", IntStream.range(0, 16).mapToObj(i -> randomBytes()).collect(Collectors.toList()));
14685

14786
b.setMapAttr2(mapAttr2);
14887

@@ -151,14 +90,13 @@ public final HugeBean hugeBean() {
15190

15291
List<Map<String, List<SdkBytes>>> value = Arrays.asList(
15392
ImmutableMapParameter.<String, List<SdkBytes>>builder()
154-
.put("key1", Arrays.asList(randomBytes(), randomBytes()))
93+
.put("key1", IntStream.range(0, 2).mapToObj(i -> randomBytes()).collect(Collectors.toList()))
15594
.build(),
15695
ImmutableMapParameter.<String, List<SdkBytes>>builder()
157-
.put("key2", Arrays.asList(randomBytes(), randomBytes(), randomBytes(), randomBytes()))
96+
.put("key2", IntStream.range(0, 4).mapToObj(i -> randomBytes()).collect(Collectors.toList()))
15897
.build(),
15998
ImmutableMapParameter.<String, List<SdkBytes>>builder()
160-
.put("key3", Arrays.asList(randomBytes(), randomBytes(), randomBytes(), randomBytes(),
161-
randomBytes(), randomBytes(), randomBytes(), randomBytes()))
99+
.put("key3", IntStream.range(0, 8).mapToObj(i -> randomBytes()).collect(Collectors.toList()))
162100
.build()
163101
);
164102

0 commit comments

Comments
 (0)