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

Optimize WriteExtensionRaw for stack buffers #330

Merged
merged 2 commits into from
Jul 5, 2023

Conversation

mhr3
Copy link
Contributor

@mhr3 mhr3 commented Jul 4, 2023

A small tweak to my previous PR - previously WriteExtensionRaw would cause the byte slice param to escape to heap (because of the call to io.Writer.Write in mw.Write) which meant there was still an allocation when using it with stack-allocated buffers. This fixes it by copying the data through the internal buffer.

msgp/extension_test.go Outdated Show resolved Hide resolved
@philhofer philhofer merged commit 6ac204f into tinylib:master Jul 5, 2023
4 checks passed
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