Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

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.


Comment on Re: IO::Select: select vs. can_read

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (7)
As of 2014-09-02 23:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite cookbook is:










    Results (33 votes), past polls