demikernel icon indicating copy to clipboard operation
demikernel copied to clipboard

[inetstack] Remove Dynamic Dispatch for PacketBufs

Open BrianZill opened this issue 2 years ago • 0 comments

PR demikernel/inetstack#193 (and runtime's PR demikernel/inetstack#34) introduced dynamic dispatch for PacketBuf (as part of the removal of the runtime generic). This has the usual problem of dynamic dispatch in Rust, which requires boxing the trait-implementing type when passing it around, as it doesn't have a known size. In this specific case, the runtime's "transmit" function now takes a "Box<dyn PacketBuf>" instead of an "impl PacketBuf", which introduces an allocation on every transmit() call.

We need a better solution for this, such as redefining PacketBuf as an enum, or replacing PacketBuf with a single concrete type used by all LibOses.

BrianZill avatar Jul 27 '22 22:07 BrianZill