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

read buffer directly when parsing string #48

Merged
merged 1 commit into from
Mar 24, 2023

Conversation

ajwootto
Copy link
Contributor

Seems to be a consequence-free performance improvement unless I'm missing something.

Each time a string is read, instead of creating a copy of the slice of the input buffer which then is used to make another copy of the data in string form, just read directly from the original input buffer when decoding into a string. Avoiding that extra allocation saves some time.

@piotr-oles
Copy link
Owner

Nice! It brings decoding performance very close to protobuf.js implementation :) Before the change, decoding was ~30% slower, now it's only ~10% slower 👏🏻

@piotr-oles piotr-oles added minor Increment the minor version when merged performance Improve performance of an existing feature labels Mar 24, 2023
@piotr-oles piotr-oles merged commit 78b734c into piotr-oles:main Mar 24, 2023
@github-actions
Copy link

🚀 PR was released in v1.3.0 🚀

@github-actions github-actions bot added the released This issue/pull request has been released. label Mar 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
minor Increment the minor version when merged performance Improve performance of an existing feature released This issue/pull request has been released.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants