On Fri, 10 Jul 2026 14:49:58 GMT, Andy Goryachev <[email protected]> wrote:
>> This mirrors roughly how `ArrayList` does this (it also increases by about >> 50% each time) instead of doubling (this has an overhead of about 25% per >> element on average, while doubling would have one of about 50% on average). >> The underlying allocation for the array memory may do alignment rounding, >> but it is not forcing power of two sizes. >> >> The reason the resizing algorithm is super deterministic is because we also >> shrink the arrays when there is no need for the space anymore (but we want >> to avoid a shrink->grow->shrink scenario on boundaries, so there is some >> overlap here). > > the growing and shrinking is fine, but 3, 7, 13 might be suboptimal since > everything revolves around powers of 2. What exactly revolves around powers of 2? The only thing that comes into play is alignment, which is usually 8 bytes. ------------- PR Review Comment: https://git.openjdk.org/jfx/pull/1081#discussion_r3560055704
