Most of the methods of Session create a Vec and copy two slices into it: the fuse_out_header and an opcode-specific response. However, this Vec is short-lived: its contents get copied again by nix::unistd::write to the fuse device.
I suggest eliminating the first data copy by changing the Session::response_sender's type to include separate buffers for the header and the data. Then use nix::unistd::writev to pass them to the kernel. It would look like this:
Most of the methods of
Session
create aVec
and copy two slices into it: thefuse_out_header
and an opcode-specific response. However, thisVec
is short-lived: its contents get copied again bynix::unistd::write
to the fuse device. I suggest eliminating the first data copy by changing theSession::response_sender
's type to include separate buffers for the header and the data. Then usenix::unistd::writev
to pass them to the kernel. It would look like this: