-
Notifications
You must be signed in to change notification settings - Fork 268
Open
Labels
Description
This is simply an observation and not a problem, so you are welcome to close as won't fix. I profiled a test build task to see if there its doing anything dumbly inefficient for a faster CI run. Overall it seems fine and GC pauses are okay, but I did notice that the majority of allocations comes from SubjectUtils building ImmutableList instances. See the attached jfr recording and the JMC and JProfiler screenshots below for the cpu and memory hotspots.
A few obvious optimizations might be,
concatis often called by methods with names likeprependNameIfAnythat pass an empty collection. SinceImmutableList.copyOfis given a wrapped iterator it must always copy, even if the only populated iterator is an ImmutableList.appendis called with a known size of elements, but the builder is not presized so it must grow to accommodate.- It's not clear if
ImmutableListis a benefit here as internal data that does not appear to be further modified. You might consider using lightweight wrappers (Arrays.asList, Collections.unmodifiableList) if a safe and non-intrusive change.
dsvoronin