Use poll() instead of select()

Waldo Bastian kde-optimize@mail.kde.org
Thu, 30 Jan 2003 12:22:06 +0100


On Thursday 30 January 2003 11:28, Lubos Lunak wrote:
> On Thursday 30 of January 2003 11:15, Jaime Torres wrote:
> > Hello,
> >
> >   I have done a small test with the very recent kde 3.1 on a
> > linux-i686-2.4.20.
> >
> >   I have readed in http://www.kegel.com/dkftpbench/Poller_bench.html
> >   that poll() is faster than select() on Linux,*BSD and I thinked that
> > also in comercial unixes, but I know that poll() is simpler to use than
> > select().
>
>  From the URL:
> (for 100 fds)
>  call       microseconds
>  select  54
>  poll     50
>
> >   I have only changed select by poll in the dcop server, resulting in a
> > dcop library of 258 bytes less and less memory normaly implies less swap
> > and better performance.
>
>  Well, 258 bytes is not going to change that much with 10+MiB KDE libraries
> I'm afraid.
>
> man poll:
> ...
> CONFORMING TO
>        XPG4-UNIX.
>
>  Isn't that a little problem? I actually don't know what this XPG4 is, but
> unless it's some widely used standard, I don't think the benefits are worth
> it.

poll does seem more suitable in these cases. We could check for the 
availability of poll and provide an implementation in kdefakes based on 
select if it isn't available.

The performance impact seems quite minimal to me, but I think poll() would be 
the right call for the job in these circumstances.

XPG4-UNIX seems like a decent standard btw
http://landru.uwaterloo.ca/cgi-bin/man.cgi?section=5&topic=standards
http://std.dkuug.dk/dkuug/stephe

Cheers,
Waldo
-- 
bastian@kde.org -=|[ SuSE, The Linux Desktop Experts ]|=- bastian@suse.com