This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
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
Attachment:
a.patch
Description: Binary data
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |