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

removed unnessecary buffered copy #1029

Merged

Conversation

andersjonsson
Copy link
Collaborator

  • added method to deserialize SoapDefinition from stream
  • removed unnessecary StreamReader usage

@zgabi made me aware that MemoryStream does not need to be disposed.
That made me realize that we could avoid a BufferedCopy of message in ReadMessageAsync.

Then I found some other perf fixes that could be done around memorystream usage in the lib.

@akshaybheda all that hoop jumping and this code is back to basically your first commit in ReadMessageAsync. 😆

added method to deserialize SoapDefinition from stream
removed unnessecary StreamReader usage
Copy link
Contributor

@akshaybheda akshaybheda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these actually look good, even i wasn't are about disposing of memory stream is not required

@akshaybheda
Copy link
Contributor

Did you run benchmark for this?

@andersjonsson
Copy link
Collaborator Author

Did you run benchmark for this?

I did. Different payload from last time, but this looks good

| Method                           | Mean     | Error     | StdDev    | Median   | Gen0   | Allocated |
|--------------------------------- |---------:|----------:|----------:|---------:|-------:|----------:|
| ReadMessageAsyncWithMemoryStream | 6.147 μs | 0.1226 μs | 0.3053 μs | 6.040 μs | 4.7455 |  19.39 KB |
| ReadMessageAsync                 | 5.342 μs | 0.1060 μs | 0.1856 μs | 5.333 μs | 3.4103 |  13.93 KB |

Just using a MemoryStream is obviously much cheaper than a buffered copy of the Message

@andersjonsson andersjonsson merged commit 85a0e12 into DigDes:develop Feb 29, 2024
2 checks passed
@akshaybheda
Copy link
Contributor

looking forward to new version, also appreciate your time on this

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