[Patch] Optimize _BFSExecutor in regex

Tim Shen timshen91@gmail.com
Mon Oct 7 21:14: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.

Probably there could be bitwise operation?

I've test the 3 trues out of 1000 elements here :
https://gist.github.com/innocentim/6874889
In my machine, choosing "v.assign(v.size(), false);" cost 1.768s and
choosing the other cost 1.088s. When we push 7 elements, they cost
almost same time. When push more than that, v.assign() shall win.

I do this because I need to use _M_clear() in this patch :)

Anyway let's use v.assign().

Thanks!


-- 
Tim Shen
-------------- next part --------------
A non-text attachment was scrubbed...
Name: a.patch
Type: application/octet-stream
Size: 13788 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20131007/c609cdd5/attachment.obj>


More information about the Libstdc++ mailing list