ev_io mode switching performance
mejedi at gmail.com
Tue May 20 09:09:54 CEST 2014
My program is repeatedly toggling an io watcher from R to RW mode and back.
This may happen multiple times per one event loop iteration. This toggling behavior
is caused because of me attempting to buffer a few data items before flush but
certain conditions may force an early flush. Before blocking the remaining data
is flushed, at least partially (in ev_prepare).
Since exchanged data items are quite small I assume flush will succeed and
there would seldom be a need to watch the underlying file descriptor to become
ready for write, i.e. the io watcher mode switching pattern bounded by the single
event loop iteration is R-(RW-R)*-RW-R.
Please tell me if this 'redundant' mode switching comes with a cost?
More information about the libev