-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Specialize fill and fill_n for vector<bool> #879
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? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for optimizing vector<bool>
! I found some issues, but the core approach appears to be solid.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.