Skip to content

Rework cbor_serialize_alloc to allocate exact buffer size upfront - #251

Merged
PJK merged 2 commits into
masterfrom
salloc
Dec 28, 2022
Merged

PJK merged 2 commits into
masterfrom
salloc

Conversation

@PJK

@PJK PJK commented Dec 28, 2022

Copy link
Copy Markdown
Owner

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

⌂ 换网址