Skip to content

Allow serializing BSON to a binary stream#525

Closed
mccullocht wants to merge 6 commits intomongodb:mainfrom
mccullocht:stream_serializer
Closed

Allow serializing BSON to a binary stream#525
mccullocht wants to merge 6 commits intomongodb:mainfrom
mccullocht:stream_serializer

Conversation

@mccullocht
Copy link
Copy Markdown

No description provided.

@abr-egn
Copy link
Copy Markdown
Contributor

abr-egn commented Apr 2, 2025

I'm pretty hesitant about this approach - it adds a lot of complexity to serialization (which is already overdrawn on the complexity budget) for a relatively narrow use case, and it also seems likely to be a significant performance hit because of the double serialization required for the length calculation.

I'm assuming your current approach is to use bson::to_vec and then write that into the destination buffer via bytes::BufMut::put - has profiling shown the allocation or copy there to be substantial cost?

@mccullocht mccullocht closed this Mar 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants