-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Closed
Labels
DocumentationIssues describing a change to documentation.Issues describing a change to documentation.NeedsFixThe path to resolution is known, but the work has not been done.The path to resolution is known, but the work has not been done.
Milestone
Description
slices.Concat calls Grow(nil, size), which rounds up the capacity allocation using append's heuristic. For example, the slice returned by Concat may have len=1000 but cap=1023. Is this intentional? I would have thought that slices.Concat is often called when the exact final size is known and no further appends are intended, making this extra allocation wasteful.
Is the idea that rounding up to the size class is essentially free, and avoids reallocation in the not uncommon case that a single element or small handful of elements are added to the end of a large slice.Concat? If so, a comment would be appreciated.
Metadata
Metadata
Assignees
Labels
DocumentationIssues describing a change to documentation.Issues describing a change to documentation.NeedsFixThe path to resolution is known, but the work has not been done.The path to resolution is known, but the work has not been done.