You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
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.
The text was updated successfully, but these errors were encountered: