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

Improve Allocation Handling #23

Open
bhansconnect opened this issue Jan 28, 2024 · 0 comments
Open

Improve Allocation Handling #23

bhansconnect opened this issue Jan 28, 2024 · 0 comments

Comments

@bhansconnect
Copy link
Collaborator

Currently we do a lot of allocating when going from rust to roc. I think we can avoid all of this on both sides.

I don't fully understand all of the pieces, but here is roughly how it would work.

Firstly, for all data being passed into roc, we will use seamless slices. This will make it so that the data does not need to be copied into roc data structures. Instead, roc will just reference the data and will never have to free it. That will make it live the entire time of the request though. So that is a tradeoff to think about. Technically more complex schemes could be used to avoid that.

Second, We need to implement the Body and Buf trait on RocList type. That will enable us to hand the roc list off to hyper with hyper reading directly from the list. Again, no need to copy data or reallocate. The implementation should be pretty simple and the same as would be done for a vector of bytes in rust.

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