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

Reduce allocations and copying by decrypting into a buffer #62

Open
rfk opened this issue Mar 25, 2021 · 0 comments
Open

Reduce allocations and copying by decrypting into a buffer #62

rfk opened this issue Mar 25, 2021 · 0 comments

Comments

@rfk
Copy link
Contributor

rfk commented Mar 25, 2021

Our current Cryptographer trait decrypts from a &[u8] and returns a Vec<u8>, for simplicity. This means that each decryption operation must allocate a new Vec to hold the result, and then we copy the bytes out of that temporary Vec and into the final output Vec.

We could reduce the amount of allocation and copying going on here if our Cryptographer trait instead accepted an output buffer as argument and decrypted into it. That's actually out the existing openssl backend works under the hood already, we just wrap it in automatic creation of the Vec.

Not urgent, but could be a nice little improvement.

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

No branches or pull requests

1 participant