[PATCH] D90884: [SmallVector] Add a default small size.
Sean Silva via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Nov 11 18:58:36 PST 2020
silvas added a comment.
In D90884#2390224 <https://reviews.llvm.org/D90884#2390224>, @mehdi_amini wrote:
> `DefaultSmallVector` is quite a "mouthful" though, I'd have thought we'd look for a "default container" that is easy to type if we have it everywhere.
>
> Why are you against `llvm::Vector` with `short string optimization`? I know that `std::vector` does not have any inline storage, but that seems like a weak reason to me: from any behavior point of view it exposes the same interface
> I see it similarly to how some implementation of `std::string` have a small-string optimization and others don't: it is an implementation detail.
I think the difference is that small string optimization typically doesn't increase sizeof(std::string) compared to the default (it does some tricks to keep the string in the header last I checked). I think a more clear example is std::function which has 3 pointers of inline storage for small closures <https://github.com/llvm/llvm-project/blob/2abc33683b2b702c00c366d56c6285fda6d1e436/libcxx/include/functional#L1756>.
Some of the precedent here for "better std::vector" is FBVector which doesn't secretly expand sizeof for inline elements AFAICT: https://github.com/facebook/folly/blob/master/folly/docs/FBVector.md
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D90884/new/
https://reviews.llvm.org/D90884
More information about the llvm-commits
mailing list