[PATCH] D90884: [SmallVector] Add a default small size.

Duncan P. N. Exon Smith via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 12 13:52:31 PST 2020


dexonsmith 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.

Agreed, the other suggested names seem better (I don't have a strong opinion about which is best).

> 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.

As others have mentioned, I think if we added small storage that was zero cost to `sizeof` that would be fine to shove into `llvm::Vector` by-default. But having `llvm::Vector` be bigger than `std::vector` seems dangerous to me, simply because it would be surprising.


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