Re: [Patch] Optimize _BFSExecutor in regex

2013-10-07 Thread Tim Shen
On Mon, Oct 7, 2013 at 8:43 PM, Jonathan Wakely wrote: > OK, this latest patch looks good so please go ahead and commit it - thanks! Committed :) -- Tim Shen

Re: [Patch] Optimize _BFSExecutor in regex

2013-10-07 Thread Jonathan Wakely
On 8 October 2013 01:06, Tim Shen wrote: > On Mon, Oct 7, 2013 at 7:11 PM, Jonathan Wakely 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,

Re: [Patch] Optimize _BFSExecutor in regex

2013-10-07 Thread Tim Shen
On Mon, Oct 7, 2013 at 7:11 PM, Jonathan Wakely 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::em

Re: [Patch] Optimize _BFSExecutor in regex

2013-10-07 Thread Jonathan Wakely
On 7 October 2013 22:14, Tim Shen wrote: > On Mon, Oct 7, 2013 at 1:28 PM, Jonathan Wakely 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. >>

Re: [Patch] Optimize _BFSExecutor in regex

2013-10-07 Thread Tim Shen
On Mon, Oct 7, 2013 at 1:28 PM, Jonathan Wakely 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 is a strange beast, remember. Prob

Re: [Patch] Optimize _BFSExecutor in regex

2013-10-07 Thread Tim Shen
On Mon, Oct 7, 2013 at 1:40 PM, Tim Shen wrote: > while (!this->empty()) > this->pop(); Sorry it's this->_M_empty() and this->_M_pop(); -- Tim Shen

Re: [Patch] Optimize _BFSExecutor in regex

2013-10-07 Thread Tim Shen
On Mon, Oct 7, 2013 at 1:28 PM, Jonathan Wakely 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 is a strange beast, remember. OK s

Re: [Patch] Optimize _BFSExecutor in regex

2013-10-07 Thread Jonathan Wakely
On 7 October 2013 18:12, Tim Shen wrote: > On Mon, Oct 7, 2013 at 12:22 PM, Jonathan Wakely > wrote: >> because that turns into the equivalent of a std::memset() on integers. > > Here I catch your idea. But think about the following example: > _M_exists.size() == 1000, but only 3 of the elements

Re: [Patch] Optimize _BFSExecutor in regex

2013-10-07 Thread Tim Shen
On Mon, Oct 7, 2013 at 7:12 AM, Jonathan Wakely wrote: > On 6 October 2013 23:43, Tim Shen wrote: >> Here's a simple piece of code >> https://gist.github.com/innocentim/6849759 the reveals _BFSExecutor's >> inefficiency. Some optimizations are here to reduce the unecessary >> time complexity from

Re: [Patch] Optimize _BFSExecutor in regex

2013-10-07 Thread Tim Shen
On Mon, Oct 7, 2013 at 12:22 PM, Jonathan Wakely wrote: > because that turns into the equivalent of a std::memset() on integers. Here I catch your idea. But think about the following example: _M_exists.size() == 1000, but only 3 of the elements are true. Now what I intend to do is assigning these

Re: [Patch] Optimize _BFSExecutor in regex

2013-10-07 Thread Tim Shen
Sorry I forgot to reply the mailing list. Here's the discussion: --- Tim On Oct 7, 2013 7:12 AM, "Jonathan Wakely" wrote: > Does _TodoList really need to derive from std::vector<_StateIdT> or > could it just have a seco

Re: [Patch] Optimize _BFSExecutor in regex

2013-10-07 Thread Jonathan Wakely
On 6 October 2013 23:43, Tim Shen wrote: > Here's a simple piece of code > https://gist.github.com/innocentim/6849759 the reveals _BFSExecutor's > inefficiency. Some optimizations are here to reduce the unecessary > time complexity from O(n^2) to O(n). > > I'll do a bootstrap and full testing befor

Re: [Patch] Optimize _BFSExecutor in regex

2013-10-06 Thread Paolo Carlini
On 10/07/2013 12:43 AM, Tim Shen wrote: Here's a simple piece of code https://gist.github.com/innocentim/6849759 the reveals _BFSExecutor's inefficiency. ... which we want in testsuite/performance/28_regex! Thanks! Paolo.

[Patch] Optimize _BFSExecutor in regex

2013-10-06 Thread Tim Shen
Here's a simple piece of code https://gist.github.com/innocentim/6849759 the reveals _BFSExecutor's inefficiency. Some optimizations are here to reduce the unecessary time complexity from O(n^2) to O(n). I'll do a bootstrap and full testing before committing. Thanks! -- Tim Shen a.patch Desc