huge socket recv speed discrepancy between different OSs

Thorben Krueger thkruege at
Thu Sep 11 21:12:14 CEST 2008

If you follow the bug report, you might notice that this is probably
an issue of socket flags. I know that *BSD and Linux handle sockets
slightly differently, but that about covers my knowledge of these
things. Maybe a solution can be found simply by setting the right
flags for the socket...

Any ideas in this line of thought?

I am kind of afraid to approach the Perl guys with this issue,
although it might be worth a try...

Hm, I fear buffers don't help me at all. You see, I wish to send
thousands of very small tcp packets to the server in as little time as
possible. Thats where the program running under OS X outperforms the
Linux version by several orders of magnitude. This is what suggests
that the problem could be lying in the difference between BSD and
Linux sockets.

OT: How would you think pypy could help, if this is OS related?

Sorry if I did not make too much sense *tired


2008/9/11 Dan Stromberg <dstromberglists at>:
> On Thu, 11 Sep 2008 16:17:58 +0200, Thorben Krueger wrote:
>> Do you see this too?
>> Mor information and testcase here:
>> I would also be interested in the profiler output under windows.
>> All the best
>> Thorben
> I regret that I don't have a lot of time to look into this interesting
> issue.
> Perl may be buffering the socket I/O.  That might be a question for
> comp.lang.perl.
> Usually, when you can reduce the number of function/method calls and
> system calls done in your innermost loop(s), especially on a high speed
> network, you've done a good thing - because otherwise CPU use becomes the
> dominant term in the performance equation.
> You might want to try my bufsock module to see if that'll help:
> It'll give you buffered sockets, along with a flush method.
> You probably also might want to try psyco when on an x86 system.
> Unfortunately, it looks like psyco isn't available for x86-64.
> Anyone know if pypy is ready to try such a program as Thorben's?
> --

More information about the Python-list mailing list