This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: [Patch] Optimize _BFSExecutor in regex
- From: Tim Shen <timshen91 at gmail dot com>
- To: Jonathan Wakely <jwakely dot gcc at gmail dot com>
- Cc: "libstdc++" <libstdc++ at gcc dot gnu dot org>, gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Mon, 7 Oct 2013 13:40:44 -0400
- Subject: Re: [Patch] Optimize _BFSExecutor in regex
- Authentication-results: sourceware.org; auth=none
- References: <CAPrifDkH0sC3FwfUrWC4Nb3h6GYsCUTvdmrgf_+UN1ZfmJwrsw at mail dot gmail dot com> <CAH6eHdQjKNAzLXCoA07T7tB5HfExEFN8rCBayvP=GCS1_=BiPg at mail dot gmail dot com> <CAPrifDko9SnheJ+aQ45W5NLyK5NKHfP_-3f0pczROiXCKf8bDg at mail dot gmail dot com> <CAH6eHdS0B6wpXQdhXTbXo1PgjnuUSjfoAbK404VE+MPAya48FQ at mail dot gmail dot com> <CAPrifDk6R9wtoZNewyNpESgkx1J6YW0xJNaut0tG-ta5RJ3p+w at mail dot gmail dot com> <CAH6eHdS81ftVScJW_zhxt=gW=2g60fnHA=0O70AQr0jpB-m4ug at mail dot gmail dot com> <CAPrifDndETV=aU82C9BB0rZv=VQRwU36WxWzM09raHEoQ8gXHA at mail dot gmail dot com> <CAH6eHdQv-fyiz2mSzOgh5EhokSKxRrbUuVvFe161Wt2+3_BNvQ at mail dot gmail dot com>
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