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
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.
The text was updated successfully, but these errors were encountered:
I suggest to follow the API of read_uninit and define fn kevent_uninit(&mut [MaybeUninit<Event>], ..) -> Result<(&mut [Event], &mut [MaybeUninit<Event>])>. So we can keep the ability to use uninitialized memory without requiring Vec.
The wrapper for
kevent()
is defined as follows:Here the
eventlist
argument is defined as&mut Vec<Event>
, requiring a heap allocating of aVec
on every call. For a system where file descriptors are frequently (un)registered (e.g. a busy socket server), it's not unlikely for theVec
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 aVec
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.
The text was updated successfully, but these errors were encountered: