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

Use ArrayPoolBufferWriter for Utf8JsonWriter for marshalling #3579

Open
wants to merge 3 commits into
base: petesong/stj-deserialization-2
Choose a base branch
from

Conversation

peterrsongg
Copy link
Contributor

@peterrsongg peterrsongg commented Dec 12, 2024

Description

This PR updates the marshalling logic so that the Utf8JsonWriter uses an ArrayPoolBufferWriter for writing json. Since we cannot take a dependency on CommunityToolkit.HighPerformance
I backported the relevant code and added it to ThirdParty.RuntimeBackports with some very minor adjustments so that it compiles.

Overall, I saw pretty huge improvements in terms of allocations and speed. Compared to the head of V4, depending on the payload size the speed improvement was anywhere from 5.7x to 12.62x faster with allocations decreasing by 3-4x.

These numbers are only for marshall/unmarshall time, not the network call

Motivation and Context

Testing

All Protocol Tests pass
Dry run will be done on the feature branch as a whole
Did some manual spot checking

Screenshots (if appropriate)

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • My code follows the code style of this project
  • My change requires a change to the documentation
  • I have updated the documentation accordingly
  • I have read the README document
  • I have added tests to cover my changes
  • All new and existing tests passed

License

  • I confirm that this pull request can be released under the Apache 2 license

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.

3 participants