reuvenlax commented on code in PR #40791:
URL: https://github.com/apache/beam/pull/40791#discussion_r4396328335
##########
sdks/java/core/src/main/java/org/apache/beam/sdk/values/Row.java:
##########
@@ -108,9 +103,12 @@ public abstract class Row implements Serializable {
/** Return a list of data values. Any LogicalType values are returned as
base values. * */
public List<Object> getBaseValues() {
- return IntStream.range(0, getFieldCount())
- .mapToObj(i -> getBaseValue(i))
- .collect(Collectors.toList());
+ int fieldCount = getFieldCount();
+ List<Object> baseValues = new ArrayList<>(fieldCount);
+ for (int i = 0; i < fieldCount; i++) {
+ baseValues.add(getBaseValue(i));
+ }
Review Comment:
This is a "hot" path, so if this is indeed faster, it might be worth
changing.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]