[Patch] Optimize _BFSExecutor in regex

Jonathan Wakely jwakely.gcc@gmail.com
Tue Oct 8 00:43:00 GMT 2013


On 8 October 2013 01:06, Tim Shen wrote:
> On Mon, Oct 7, 2013 at 7:11 PM, Jonathan Wakely <jwakely.gcc@gmail.com> wrote:
>> The version in your gist (which is *not* what your first patch did!)
>> is faster for any size of _M_exists and any ratio of _M_states.size()
>> / _M_exists.size():
>
> Sorry for my original patch, I made a mistake! It's:
>       while (!_BaseT::empty())
>         _BaseT::pop_back();
> but I truely meant:
>       while (!this->_M_empty())
>         this->_M_pop();
> To make all trues reset.

Yes, that's what I was trying to say in my first mail :-)

> In my machine the while loop is slower than assign() when the
> _M_states.size() / _M_exists.size() is more than even 7/1000. so let's
> keep the assign(), because the ratio in regex could probably be more
> than 25%.

OK, this latest patch looks good so please go ahead and commit it - thanks!



More information about the Libstdc++ mailing list