# Improve \(Unmanaged\)ArrayList.insert · gitcafe/zig

[View on GitCafe](https://git.cafe/gitcafe/zig/commit/303181901b0a5e62ece5d4b786ee537a50d07709)

Repository: [gitcafe/zig](https://git.cafe/gitcafe/zig)

Visibility: public

Requested revision: 303181901b0a5e62ece5d4b786ee537a50d07709

Requested commit: 303181901b0a5e62ece5d4b786ee537a50d07709

Commit: 303181901b0a5e62ece5d4b786ee537a50d07709

Tree: fc2ce51e937ee3499bb18e64271a3928f3db1655

Author: Lucas Santos

Committer: Andrew Kelley

## Message

```
Improve (Unmanaged)ArrayList.insert

(Unmanaged)ArrayList.insert has the same inefficiency as the old insertSlice. With the new addManyAt, the solution is trivial.
Also improves the test "growing memory preserves contents". In the previous implementation, if any changes were made to the ArrayList memory growth policy (function growMemory), the list could end up with enough capacity to not trigger a memory growth, defeating the purpose of the test. The new implementation more robustly triggers a memory growth.
```

## Parents

- [937e8cb7051a3de537e11c2d52946f772f7449c3](https://git.cafe/gitcafe/zig/commit/937e8cb7051a3de537e11c2d52946f772f7449c3?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zig/tree/303181901b0a5e62ece5d4b786ee537a50d07709?format=markdown)
