wenbingshen opened a new pull request, #16754: URL: https://github.com/apache/pulsar/pull/16754
### Motivation Optimize concurrent collection's shrink and clear logic. This PR was releated to bookkeeper's PR:https://github.com/apache/bookkeeper/pull/3417 ### Modifications 1. Reduce the repeated `Arrays.fill` in the clear process 2. When `capacity` is already equal to `initCapacity`,`rehash` should not be executed 3. Reduce the `rehash` logic in the `clear` process 4. Shrinking must at least ensure `initCapacity`, so as to avoid frequent shrinking and expansion near `initCapacity`, frequent shrinking and expansion, additionally opened `arrays` will consume more memory and affect GC. ### Documentation Need to update docs? - [x] `doc-not-needed` -- 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]
