ArrayBufferWriter instead of MemoryStream for Utf8JsonWriter#341
Draft
erwinkramer wants to merge 1 commit intocloudevents:mainfrom
Draft
ArrayBufferWriter instead of MemoryStream for Utf8JsonWriter#341erwinkramer wants to merge 1 commit intocloudevents:mainfrom
ArrayBufferWriter instead of MemoryStream for Utf8JsonWriter#341erwinkramer wants to merge 1 commit intocloudevents:mainfrom
Conversation
Signed-off-by: Erwin <erwinkramer@hotmail.com>
Contributor
Author
|
@jskeet let me know your thoughts |
Contributor
|
Will do when I can, but I don't know when I'll get to it. Maybe over the weekend, but I'm not promising. |
Contributor
|
Given that this one looks pretty fiddly, I think it would be good to compare performance. If it's only a small part of the performance penalty, it may not be worth it... if it makes a huge difference, it's worth looking at. Having some benchmarks for the project would be a good thing in general... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Instead of doing
ToArraywe can doWrittenMemoryto return the (readonly) memory, this should reduce allocation, memory and improve speed.This won't work on netstandard2.0, the writer isn't included via
System.Buffers... so if you like this setup then 3 methods will get different signatures for the old frameworks, which isn't elegant. This draft just displays the basic intention.