Split body memory into distinct parts for better clarity and avoiding to copy for the send path when a single ROM is passed#20098
Conversation
… to copy for the send path when a single ROM is passed
|
Thank you for your contribution @danielmarbach! We will review the pull request and get back to you soon. |
|
@JoshLove-msft I wanted to see if it would be worthwhile to split the send and the receive path a bit in terms of BodyMemory in order to verify if it is possible to avoid copying the single ROM on the send path. Here is the result. What do you think? |
|
I used the same test suite as the previous PR but did access the body during send BeforeAfter |
|
Interesting, I think that I get what you're up to. If you don't mind, I'm going to state my understanding and ask you to keep me honest:
How am I doing so far? |
|
The Body Memory approach gives us a construct that knows to only materialize the value once, no matter how many times the Nice.... assuming that I'm close, I think we've got the end-to-end story. Awesome! |
Yes, that is my understanding. This PR makes the send "happy path" more efficient by avoiding the ArrayBufferWriter usage when we know there is a single ReadOnlyMemory. |
|
@danielmarbach thanks for doing this - it looks great! Any chance we can add a few unit tests that validate that the Body is correct at several points in the lifetime of a message, e.g. whether setting with the property or through the AmqpAnnotatedMessage. |
I can see what I can do |
|
/azp run net - servicebus - tests |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
/azp run net - servicebus - tests |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
/azp run net - servicebus - tests |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
Will merge this after releasing the new beta as we are past the code complete date. |


Follow up for #19996
All SDK Contribution checklist:
This checklist is used to make sure that common guidelines for a pull request are followed.
Draftmode if it is:General Guidelines and Best Practices
Testing Guidelines
SDK Generation Guidelines
*.csprojandAssemblyInfo.csfiles have been updated with the new version of the SDK. Please double check nuget.org current release version.Additional management plane SDK specific contribution checklist:
Note: Only applies to
Microsoft.Azure.Management.[RP]orAzure.ResourceManager.[RP]Management plane SDK Troubleshooting
new servicelabel and/or contact assigned reviewer.Verify Code Generationstep, please ensure:generate.ps1/cmdto generate this PR instead of callingautorestdirectly.Please pay attention to the @microsoft.csharp version output after running generate.ps1. If it is lower than current released version (2.3.82), please run it again as it should pull down the latest version,
Old outstanding PR cleanup
Please note:
If PRs (including draft) has been out for more than 60 days and there are no responses from our query or followups, they will be closed to maintain a concise list for our reviewers.