Skip to content
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

Fewer allocations to put smaller bitset to stream #4818

Merged
merged 6 commits into from
Jul 11, 2024

Conversation

AlexGuteniev
Copy link
Contributor

The value of 128 bytes is arbitrary, could be greater if we are brave.

I kept variable _Len as opposer to _Bits constant, as constant propagation apparently engages a very harmful optimization.

Didn't benchmark precisely output to stream, I think if falls under "definitely good" category; if not, I can add, but then will need to wait for #4817

@AlexGuteniev AlexGuteniev requested a review from a team as a code owner July 7, 2024 11:02
@StephanTLavavej StephanTLavavej added the performance Must go faster label Jul 8, 2024
@StephanTLavavej StephanTLavavej self-assigned this Jul 8, 2024
@AlexGuteniev
Copy link
Contributor Author

Can go furthr and convert to digit array by parts, and stream those parts, this way can avoid sllocations altogether.

But this would be more complex change

stl/inc/bitset Outdated Show resolved Hide resolved
@StephanTLavavej
Copy link
Member

I think this is plenty - large bitsets are increasingly uncommon, and anyone touching iostreams isn't going to have great perf in the first place.

@StephanTLavavej StephanTLavavej removed their assignment Jul 8, 2024
@AlexGuteniev
Copy link
Contributor Author

anyone touching iostreams isn't going to have great perf in the first place

Well, stringstream is not as that, but generally agree.

@StephanTLavavej StephanTLavavej self-assigned this Jul 10, 2024
@StephanTLavavej
Copy link
Member

I'm mirroring this to the MSVC-internal repo - please notify me if any further changes are pushed.

@StephanTLavavej StephanTLavavej merged commit 0586819 into microsoft:main Jul 11, 2024
39 checks passed
@StephanTLavavej
Copy link
Member

Thanks for letting the allocator take some vacation days! 🏖️ 🥳 😹

@AlexGuteniev AlexGuteniev deleted the bitstream branch July 12, 2024 04:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
performance Must go faster
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants