Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Various buffer optimizations (#1211)
This PR is a set of small cleanups to reduce `memcpy` and `memset` calls in `Buffer` wrangling. - `Buffer::eat` just swaps pointers if it's a complete (fully owned) overwrite, instead of using `memcpy` - `Buffer::eat` no longer sets the size of the eaten buffer to 0, to avoid `memset` when scaling it up later - Added a new `Buffer:reset_owned`, which resizes and clears the `owned` flags but **does not** clear buffer data (for the case where we're about to overwrite buffer data anyways) - Use this new function in `Volume::read` - In `Volume::read`, read directly into the provided buffer if there's only one subvolume (instead of reading into a scratch buffer then copying) - The scratch buffer is no longer always allocated; it's resized if needed
- Loading branch information