Closed
Description
This has probably been discussed before but in case it hasn't: It should be possible to store a vec's capacity as part of its heap allocation and thus shrink Vec
from three to two words. It would make a difference for code that contains many empty Vec
s and code that moves them around a lot. The downside is that the implementation is a bit more complicated and that the capacity can only be accessed after following a pointer. It might still be a worthwhile trade off.
cc @rust-lang/libs (and @nnethercote who likes this kind of thing :)
)