[Patch] Optimize _BFSExecutor in regex
Tim Shen
timshen91@gmail.com
Mon Oct 7 17:40:00 GMT 2013
On Mon, Oct 7, 2013 at 1:28 PM, Jonathan Wakely <jwakely.gcc@gmail.com> wrote:
> std::memset() on about 125 bytes is not a big deal, I doubt it's
> significantly more expensive than the calculations to find the right
> bits and do the necessary masking for three elements.
> std::vector<bool> is a strange beast, remember.
OK so I may change to use something else(bitset?) next time I encounter this.
Is copying 125 bytes more expensive comparing to 3 assignment and
substrction? Because it *is* cheap to find all elements that's true,
they are just in _M_base(in the latest patch). So:
while (!this->empty())
this->pop();
...will be executed only 3 times. I think it's cheaper than copying a
long-enough and sparse-enough byte chunk? Or at least we should theck
the density(_M_base.size() / _M_exists.size()) of _M_exists ?
--
Tim Shen
More information about the Libstdc++
mailing list