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

Rework cbor_serialize_alloc to allocate exact buffer size upfront #251

Merged
merged 2 commits into from
Dec 28, 2022
Merged

Conversation

PJK
Copy link
Owner

@PJK PJK commented Dec 28, 2022

Description

  • The allocate-serialize-retry loop was ugly and inefficient, especially for large items that might take a number of tries to succeed
  • Will also waste less memory
  • The downside is that the old API doesn't match the new logic so well, the return value and the output parameter are redundant now. Given the number of clients (https://github.com/search?q=cbor_serialize_alloc&type=code), I will keep the function as-is for now since it is backwards compatible

Checklist

  • I have read followed CONTRIBUTING.md
    • I have added tests
    • I have updated the documentation
    • I have updated the CHANGELOG
  • Are there any breaking changes?
    • If yes: I have marked them in the CHANGELOG (example)
  • Does this PR introduce any platform specific code?
  • Security: Does this PR potentially affect security?
  • Performance: Does this PR potentially affect performance?

@PJK PJK merged commit c55642a into master Dec 28, 2022
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.

1 participant