Trim to size lists created in source fetchers#130521
Conversation
|
Pinging @elastic/es-search-foundations (Team:Search Foundations) |
|
Hi @iverase, I've created a changelog YAML for you. |
| ArrayList<Object> values = new ArrayList<>(); | ||
| for (String path : sourcePaths) { | ||
| Object sourceValue = source.extractValue(path, nullValue); | ||
| if (sourceValue == null) { |
There was a problem hiding this comment.
This isn't directly related to your changes. Still, it appears that the code exits early on the first null value, potentially skipping other paths that may contain valid data. Do you happen to know if that behavior is intentional?
There was a problem hiding this comment.
It has always been like that so I would say it is intentional.
|
The update looks good to me. Are there any other classes where a similar change could be applied? I noticed, for example, that |
I looked around and I didn't found any, I actually missed |
This commit trim to size those lists to prevent wasteful heap usage.
This commit trim to size those lists to prevent wasteful heap usage.
This commit trim to size those lists to prevent wasteful heap usage.
This commit trim to size those lists to prevent wasteful heap usage.
Looking at a heap dump, in most of the cases we will have just one value, still those lists allocate 10 slots which can be pretty wasteful. This commit trim to size those lists to prevent wasteful heap usage.