ndarray
ndarray copied to clipboard
Add reserve method for owned arrays
This PR adds an array.reserve(axis, additional) method for use when appending multiple times to an array.
It abstracts over the code in append that was calling OwnedRepr::reserve in order to expose it.
Benchmark results (appending 100 times to an empty array):
test push_no_reserve ... bench: 900 ns/iter (+/- 52)
test push_reserve ... bench: 739 ns/iter (+/- 50)
Note I'm new to the crate so I may have missed something, but happy to iterate if there's more to do.