Specialize fill and fill_n for vector<bool>#879
Specialize fill and fill_n for vector<bool>#879StephanTLavavej merged 13 commits intomicrosoft:masterfrom
Conversation
1461cae to
dbc59be
Compare
|
I spent some time messing with this and ended up effectively identical to yours except the calculation of _LastSourceMask is guarded by _Last._Myoff != 0 which resolves the forbidden full shift issue. does that seem OK? |
BillyONeal
left a comment
There was a problem hiding this comment.
We need to not do the forbidden full shift; other than that my other comments were extreme nitpicks or wrong.
|
Thanks that looks really good. I believe the I agree that static casts are not safe per se. That said, integer promotions are notoriously tricky and who knows what happens if _Vbase changes some time in the future. |
The comment follows exactly because of that check at the beginning; asserts are free for product code :) |
|
Thanks a lot @BillyONeal |
StephanTLavavej
left a comment
There was a problem hiding this comment.
Thanks for optimizing vector<bool>! I found some issues, but the core approach appears to be solid.
StephanTLavavej
left a comment
There was a problem hiding this comment.
Looks good, will validate and push minor changes for the last remaining issues. Thanks!
|
Thanks for this significant perf improvement - it fills me with joy! 😹 |
This partially addresses #625 by specializing fill and fill_n
This is essentially a subpart of #750 with one of the algorithms where the implementation is both simple and a clear win.