[Python-Dev] FW: [Python-Help] Python threads with suncc (Forte 6.1) compiler
Guido van Rossum
guido@zope.com
Sun, 05 Aug 2001 20:30:36 -0400
> "Tim Peters" <tim.one@home.com> writes:
>
> > [Guido, on reworking select()]
> > > Yes, I think we do need this. PyObject_AsFileDescriptor() calls the
> > > fileno() method which could be a Python call.
> >
> > Ya, but for me to believe that *matters*, I have to believe people worried
> > about high-performance select are passing objects with Python-implemented
> > fileno methods to begin with. That's quite a stretch, isn't it? They have
> > to pay for fileno() calls regardless, the question is only whether they pay
> > it once or twice per object.
[And Tim posted an interesting alternative implementation]
That looks like a good way to avoid the double fileno() calls.
Drawback: the implementation you sketched seems to create a twople per
file descriptor. That's not quite a malloc (twoples are cached), but
still.
If someone feels like implementing this, please go ahead!
[MH]
> Posted admittedly without checking any facts:
>
> (1) Doesn't the Python fileno() method issue leave you open to
> ridiculous fileno() methods that mutate the list passed in to
> select()?
Yes, but the select code is immune to that -- it may get an
exception but it correctly propagates those.
> (2) AIUI, if you really care about performance you should be using
> poll() anyway (tho' obviously this depends on your platform having
> poll() in the first place, and I don't have the faintest idea how
> widespread it is).
Very widespread. I forget -- what's the reason for poll()'s claim to
better performance?
--Guido van Rossum (home page: http://www.python.org/~guido/)