Closed
Description
The wrapper for kevent()
is defined as follows:
pub unsafe fn kevent(
kqueue: impl AsFd,
changelist: &[Event],
eventlist: &mut Vec<Event>,
timeout: Option<Duration>,
) -> io::Result<usize>
Here the eventlist
argument is defined as &mut Vec<Event>
, requiring a heap allocating of a Vec
on every call. For a system where file descriptors are frequently (un)registered (e.g. a busy socket server), it's not unlikely for the Vec
allocations to become a bit of a problem.
Would it be possible to change the signature such that eventlist
is a &mut [Event]
instead? This way one can simply stack allocate the slice, and still use a Vec
if deemed necessary (e.g. one is expecting many events).
Some of this was discussed in #578, but it seems nothing was done in response.
Metadata
Metadata
Assignees
Labels
No labels