discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Patches for poll-based NSRunLoop


From: Kaelin Colclasure
Subject: Re: Patches for poll-based NSRunLoop
Date: Sat, 26 Jan 2002 14:02:12 -0800
User-agent: Microsoft-Entourage/10.0.0.1309

On 1/26/02 9:21 AM, "Jonathan B. Leffert" <jonathan@leffert.net> wrote:

> On Sat, Jan 26, 2002 at 10:17:28AM +0000, Richard Frith-Macdonald wrote:
> 
>> I think I said 'almost trivial' - but that's from the point of view
>> of someone who has been writing unix comms related software since before
>> either select() or poll() existed (around 20 years), and is very familiar
>> with NSRunLoop ... so I guess 'straightforward' may be more appropriate.
> 
> Please forgive, then, what is probably a naive question.  What is the
> purpose of this patch?  Does poll generally scale better than select or is
> it that poll has a more straightforward api?

Yes, and (IMO) yes. :-) select has the annoying limitation of FD_SETSIZE,
which in the case of NSRunLoop means if you need more than FD_SETSIZE file
descriptors you need to recompile GNUstep base. On OpenBSD, for example, the
default FD_SETSIZE is only 256.

After the switch to poll, NSRunLoop is working beautifully for my
application which uses ~10000 descriptors. [Yes, it could be made more
efficient... Perhaps a future patch.]

The use of select also commonly leads to low-numbered (or high-numbered)
file descriptors being serviced preferentially... NSRunLoop explicitly
defeats this bias programmatically, but the issue doesn't (generally) come
up with poll. Also, poll is significantly more efficient with large, sparse
sets of descriptors.

Admittedly none of this is likely to affect your GUI apps one way or the
other (although optimizing the inner event loop as Richard suggested could
possibly make a difference, you would likely need a profiler to see it).
However, with this patch NSRunLoop (and NSNotificationCenter and so on) can
be used for server-side programming too.

-- Kaelin




reply via email to

[Prev in Thread] Current Thread [Next in Thread]