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

experiment: alloc uninitialised buffer for incoming decrypted data #337

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

achingbrain
Copy link
Member

@chainsafe/noise has an optimisation where the buffer containing incoming encrypted data is reused for the decrypted data to avoid allocing a new buffer.

This data arrives as a Uint8ArrayList so where it spans more than one buffer it can involve copying the data first, only to then overwrite it.

This experiment tests:

  • v1.0: default behaviour
  • v1.0-noise-alloc: use alloc unsafe to allocate a new unitialised buffer
  • v1.0-noise-alloc-smart: only alloc unsafe if the list contains more than one buffer

achingbrain and others added 2 commits December 2, 2023 07:22
`@chainsafe/noise` has an optimisation where the buffer containing
incoming encrypted data is reused for the decrypted data to avoid
allocing a new buffer.

This data arrives as a `Uint8ArrayList` so where it spans more than
one buffer it can involve copying the data first, only to then
overwrite it.

This experiment tests:

- v1.0: default behaviour
- v1.0-noise-alloc: use alloc unsafe to allocate a new unitialised buffer
- v1.0-noise-alloc-smart: only alloc unsafe if the list contains more than one buffer
Copy link
Contributor

github-actions bot commented Dec 2, 2023

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