demikernel
demikernel copied to clipboard
[inetstack] Remove Dynamic Dispatch for PacketBufs
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.