-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
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! |
sdk/servicebus/Azure.Messaging.ServiceBus/src/Amqp/BodyMemory.cs
Outdated
Show resolved
Hide resolved
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 |
sdk/servicebus/Azure.Messaging.ServiceBus/src/Amqp/BodyMemory.cs
Outdated
Show resolved
Hide resolved
sdk/servicebus/Azure.Messaging.ServiceBus/src/Amqp/BodyMemory.cs
Outdated
Show resolved
Hide resolved
/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.
Draft
mode if it is:General Guidelines and Best Practices
Testing Guidelines
SDK Generation Guidelines
*.csproj
andAssemblyInfo.cs
files 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 service
label and/or contact assigned reviewer.Verify Code Generation
step, please ensure:generate.ps1/cmd
to generate this PR instead of callingautorest
directly.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.