RFR: 8295808: GrowableArray should support capacity management [v2]
Kim Barrett
kbarrett at openjdk.org
Tue Oct 25 17:43:38 UTC 2022
On Mon, 24 Oct 2022 08:11:42 GMT, Axel Boldt-Christmas <aboldtch at openjdk.org> wrote:
>> Kim Barrett has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains eight additional commits since the last revision:
>>
>> - Merge branch 'master' into ga-capacity
>> - copyrights
>> - use reserve/shrink_to_fit in StringDedupTable
>> - gtests for capacity functions
>> - add reserve and shrink_to_fit
>> - max_length() => capacity()
>> - initial_capacity => capacity
>> - capacity nomenclature
>
> LGTM.
>
> Any thoughts of moving `expand_to` and `shrink_to_fit` to a common function, given that they share a lot of logic.
> Something like a general resize that
> * Allocates if `new_capacity != 0`
> * Copy constructs new elements from `0` to `min(old_capacity, new_capacity)`
> * Default constructs from `min(old_capacity, new_capacity)` to `new_capacity`
> * Destroy old elements from `0` to `old_capacity`
Thanks @xmas92 , @tschatzl , and @sspitsyn for reviews.
-------------
PR: https://git.openjdk.org/jdk/pull/10827
More information about the serviceability-dev
mailing list