Reduce over-allocation

This commit is contained in:
Jarred Sumner
2023-05-07 23:52:05 -07:00
parent 35685bbc86
commit 56bd410044
2 changed files with 4 additions and 4 deletions

View File

@@ -393,7 +393,7 @@ pub fn MultiArrayList(comptime S: type) type {
pub fn clone(self: Self, gpa: Allocator) !Self {
var result = Self{};
errdefer result.deinit(gpa);
try result.ensureTotalCapacity(gpa, self.len);
try result.setCapacity(gpa, self.len);
result.len = self.len;
const self_slice = self.slice();
const result_slice = result.slice();