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:
This removes the need for dynamically allocating a Vec when the kevent()
function is called. The documentation is also rephrased slightly as
slices don't really have a "capacity", but only a fixed-size length.
This fixesbytecodealliance#1043.
This removes the need for dynamically allocating a Vec when the kevent()
function is called. The documentation is also rephrased slightly as
slices don't really have a "capacity", but only a fixed-size length.
This fixesbytecodealliance#1043.
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: