Skip to content

Conversation

@vtjnash
Copy link
Member

@vtjnash vtjnash commented Oct 1, 2025

array: reduce overallocation when inserting into small arrays

Fixes a minor nuisance where length 0 would grow to 8 and length 7 would also grow to 8. Instead growing by a flat 3x even initially.

Fixes #58640

@vtjnash vtjnash requested a review from oscardssmith October 1, 2025 13:25
@vtjnash vtjnash added the backport 1.12 Change should be backported to release-1.12 label Oct 1, 2025
@vtjnash
Copy link
Member Author

vtjnash commented Oct 1, 2025

@nanosoldier runbenchmarks(ALL, vs=":master")

@nanosoldier
Copy link
Collaborator

Your benchmark job has completed - possible performance regressions were detected. A full report can be found here.

@oscardssmith
Copy link
Member

oscardssmith commented Oct 2, 2025

Nanosoldier results seem noisy as expected. (allocations mostly down, runtime slightly up for some, slightly down for others).

maxsize is usually typemax, so need to be careful to not do comparisons after adding to it. Substracting from it should normally be perfectly fine. At worst we should compute a negative amount of space remaining.
Fixes a minor nuisance where length 0 would grow to 8 and length 7 would
also grow to 8. Instead growing by a flat 3x even initially.

Fixes #58640
@vtjnash vtjnash changed the base branch from master to jn/iob-oob-writes October 2, 2025 18:34
@vtjnash vtjnash marked this pull request as draft October 2, 2025 18:35
Base automatically changed from jn/iob-oob-writes to master October 3, 2025 15:22
@KristofferC KristofferC mentioned this pull request Oct 6, 2025
47 tasks
@vtjnash vtjnash marked this pull request as ready for review October 6, 2025 21:12
@vtjnash vtjnash merged commit e16dfe2 into master Oct 6, 2025
9 checks passed
@vtjnash vtjnash deleted the jn/58640 branch October 6, 2025 21:15
KristofferC pushed a commit that referenced this pull request Oct 10, 2025
…ys (#59717)

Fixes a minor nuisance where length 0 would grow to 8 and length 7 would
also grow to 8. Instead growing by a flat 3x even initially.

Fixes #58640

(cherry picked from commit e16dfe2)
KristofferC pushed a commit that referenced this pull request Oct 12, 2025
…ys (#59717)

Fixes a minor nuisance where length 0 would grow to 8 and length 7 would
also grow to 8. Instead growing by a flat 3x even initially.

Fixes #58640

(cherry picked from commit e16dfe2)
KristofferC pushed a commit that referenced this pull request Oct 14, 2025
…ys (#59717)

Fixes a minor nuisance where length 0 would grow to 8 and length 7 would
also grow to 8. Instead growing by a flat 3x even initially.

Fixes #58640

(cherry picked from commit e16dfe2)
@KristofferC KristofferC removed the backport 1.12 Change should be backported to release-1.12 label Oct 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

prepend! allocates when X is empty even when there's capacity again

4 participants