jtuglu-netflix commented on code in PR #17847:
URL: https://github.com/apache/druid/pull/17847#discussion_r2067129281
##########
server/src/main/java/org/apache/druid/segment/realtime/appenderator/StreamAppenderator.java:
##########
@@ -354,40 +376,43 @@ public AppenderatorAddResult add(
boolean isPersistRequired = false;
boolean persist = false;
- List<String> persistReasons = new ArrayList<>();
+ final String[] persistReasons = new String[NUMBER_OF_PERSIST_REASONS];
Review Comment:
Yeah. In c++ std::array is guaranteed stack allocation whereas the resizable
equivalent is heap-based (slower). I guess in Java this distinction isn't as
stark since you can't actually control where the memory is allocated. The
difference showed up in the profile, but:
> The downside of using arrays is that future maintainers will have to
resize the array when they want to add reasons.
We can leave for now due to this^
##########
server/src/main/java/org/apache/druid/segment/realtime/appenderator/StreamAppenderator.java:
##########
@@ -354,40 +376,43 @@ public AppenderatorAddResult add(
boolean isPersistRequired = false;
boolean persist = false;
- List<String> persistReasons = new ArrayList<>();
+ final String[] persistReasons = new String[NUMBER_OF_PERSIST_REASONS];
Review Comment:
Yeah. In c++ std::array is guaranteed stack allocation whereas the resizable
equivalent vector is heap-based (slower). I guess in Java this distinction
isn't as stark since you can't actually control where the memory is allocated.
The difference showed up in the profile, but:
> The downside of using arrays is that future maintainers will have to
resize the array when they want to add reasons.
We can leave for now due to this^
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]