You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
With the growing popularity of using Features, I think it's important to
ensure our Features querying set is as fast as possible. In particular,
we sometimes may end up putting a feature check in a hot function, so
the `contains` overhead is important.
While I haven't done *any* measurements to verify this, I think a
`llvm::SmallSet<Feature, 2>` is slower than a FixedBitSet. For the
former, if the set grows more than the constant size, it switches over
to using a `std::set`. Setting the size to `numFeatures()` is not
particularly attractive or possible, because `SmallSet` is limited to a
size of 32 to be considered small, as it uses linear search over a
SmallVector to service a `contains` query.
Meanwhile, a FixedBitSet has a small constant factor overhead for
querying if the element is contained: two divisions by a
constant power-of-two, a bit shift, and a memory-read / compare. I think
that'll beat a SmallSet in all cases.
0 commit comments