Skip to content

Optimize RawBsonDocument encode and decode by eliminating intermediate allocations#1988

Merged
rozza merged 2 commits into
mongodb:mainfrom
rozza:JAVA-6133
May 28, 2026
Merged

Optimize RawBsonDocument encode and decode by eliminating intermediate allocations#1988
rozza merged 2 commits into
mongodb:mainfrom
rozza:JAVA-6133

Conversation

@rozza

@rozza rozza commented May 28, 2026

Copy link
Copy Markdown
Member
  • Add BsonInput.pipe(BsonOutput, int) to remove the temporary byte[] copy in BsonBinaryWriter.pipeDocument() on both encode and decode paths
  • Add public getByteBacking(), getByteOffset(), getByteLength() on RawBsonDocument to expose the backing byte array

JAVA-6133

…e allocations

- Add BsonInput.pipe(BsonOutput, int) to remove the temporary byte[] copy in BsonBinaryWriter.pipeDocument() on both encode and decode paths
- Add public getByteBacking(), getByteOffset(), getByteLength() on RawBsonDocument to expose the backing byte array

JAVA-6133
@rozza rozza marked this pull request as ready for review May 28, 2026 12:24
@rozza rozza requested a review from a team as a code owner May 28, 2026 12:24
@rozza rozza requested a review from vbabanin May 28, 2026 12:24
@rozza

rozza commented May 28, 2026

Copy link
Copy Markdown
Member Author

@vbabanin #1913 seems to be stuck (likely due to yesterdays github outage). Just rebased it here and doing a final evergreen pass before merging.

@rozza rozza merged commit 98e0761 into mongodb:main May 28, 2026
53 checks passed
@rozza rozza deleted the JAVA-6133 branch May 28, 2026 13:20
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