On Sat, Apr 19, 2008 at 11:43:20AM +0200, Jonathan Schleifer wrote:
> "Edwin Eyan Moragas" <[EMAIL PROTECTED]> wrote:
> 
> > the question is, which one is more useful when writing new servers?
> > kqueue or poll?
> 
> poll is more portable, while kqueue should be more performant (at
> least, that's why it was invented). If your app only needs to run on
> OpenBSD, NetBSD and FreeBSD, you're just fine with kqueue, otherwise
> use poll. Generally, I think it's better to use poll and sacrifice that
> unnoticable performance gain.

As usual, depends what you want to do.

poll() and select() give you control over file descriptors. kqueue
encompasses more events. It's not especially faster, it just leads to
simpler code in case you need the supplementary events.

If all you need to do is watch over a set of file descriptors, poll
and select are the simplest ones to use... and the most portable.

In many, many cases, poll() is better. The only case where select comes
close is when you want to watch over most of your file descriptors (because
you access less memory in such a case).

And then, you should profile. I'm not even sure it makes a difference.

Most of the places in the system where we have select() are legacies: it
it's not broken, don't fix it.

Reply via email to