Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things

Re: IO::Select: select vs. can_read

by MarkM (Curate)
on May 05, 2003 at 13:35 UTC ( #255617=note: print w/replies, xml ) Need Help??

in reply to IO::Select: select vs. can_read

In theory, can_read() is more efficient in cases where you have a large number of clients that remains mostly constant between calls to can_read(), since add() and remove() should be performing only bit operations, wheras IO::Select::select() re-creates the bit mask every time.

In practice, I wouldn't be able to guess which one is faster. Graham Barr (the author of IO::Select) does implement add() and remove() using bit operations, however, he has a lot of rather inefficient code between add(), remove() and the code that actually does the bit operations.

Personally, I make the bit fields myself. The code isn't that complicated, and I handle things that can_read() does not such EINTR. add() is implemented in terms of vec(...) = 1, etc.

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://255617]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (3)
As of 2022-08-18 01:06 GMT
Find Nodes?
    Voting Booth?

    No recent polls found