Make Vec and String be slices
Rust Internals
Make Vec and String be slices
IMHO Vecs and Strings are wasteful in storing the capacity along with the pointer and length. On 64bit systems this makes them to big to fit into u128 registers, where available. And on every move there is an extra usize to push around. If we moved the capacity to the heap, we’d save that memory for unallocated Vecs and Strings. And it would not be on the stack again in each frame through which it gets passed down (unless they are optimised to overlap.) I propose putting the capacity at the be...
0 comments
No comments yet.