Re: Timings for optimised poll(2)

Dean Gaudet (dgaudet-list-linux-kernel@arctic.org)
Mon, 25 Aug 1997 08:43:01 -0700 (PDT)


On Mon, 25 Aug 1997, Rogier Wolff wrote:

> > select() is O(n) where n is the max descriptor. poll() is O(m) where m is
>
> No:
>
> 1) m = O(n) in the cases that we are interested in.

?? suppose I'm selecting on only descriptor number 10397. select has to
scan 10397 bits to build a poll list. poll's loop iterates once. What
cases is it that you think are important? I can guarantee that real
programs do select()s on sparse datasets. poll is a win on sparse
datasets.

> 2) The kernel builds a list of the selected-on fd's and indeed needs to
> poll the whole list to get the set of ready descriptors.

hence select is at least as expensive as poll inside the kernel.

> My timing example shows that you can totally obliterate the "extra
> overhead" That Richard claims exists for using "select". He wrote some
> code that is 10000 times slower than mine, and then starts shouting
> that we need a different kernel-interface.

Um maybe I didn't look closely enough at your code. But I seem to recall
it timing user-land only and completely ignoring the expense of select()
inside the kernel.

Dean