[issue3766] socket.socket.recv broken (unbearably slow)

Thorben Krueger report at bugs.python.org
Wed Sep 10 09:26:02 CEST 2008


Thorben Krueger <thkruege at uos.de> added the comment:

As promised, here is the profiler output for a Mac (thanks Stefan). The
problem does NOT occur here, which should help greatly in tracking down
the cause in the socket library. Anyone into this?

$ python runme.py
500 packets @ 2 tokens each (500 very short lists)
0.0814669132233
        14508 function calls in 0.082 CPU seconds

  Ordered by: internal time

  ncalls  tottime  percall  cumtime  percall filename:lineno(function)
    1500    0.048    0.000    0.048    0.000 {method 'recv' of
'_socket.socket' objects}
    1500    0.015    0.000    0.015    0.000 <string>:1(sendall)
    1500    0.003    0.000    0.021    0.000 Client.py:8(send_int)
    1500    0.003    0.000    0.053    0.000 Client.py:16(read_int)
     500    0.003    0.000    0.057    0.000 Client.py:19(read_int_list)
    1500    0.002    0.000    0.002    0.000 struct.py:77(unpack)
    1500    0.002    0.000    0.002    0.000 struct.py:54(pack)
     500    0.001    0.000    0.022    0.000 Client.py:11(send_int_list)
       1    0.001    0.001    0.082    0.082 runme.py:12(bench)
    1000    0.001    0.000    0.001    0.000 {method 'insert' of 'list'
objects}
    1001    0.001    0.000    0.001    0.000 {range}
     500    0.001    0.000    0.080    0.000 Client.py:28(spam)
    1500    0.000    0.000    0.000    0.000 {method 'unpack' of
'Struct' objects}
     501    0.000    0.000    0.000    0.000 {len}


1 packet @ 50000 tokens (1 very long list)
5.20953297615
        400018 function calls in 5.210 CPU seconds

  Ordered by: internal time

  ncalls  tottime  percall  cumtime  percall filename:lineno(function)
   50001    2.267    0.000    2.267    0.000 <string>:1(sendall)
   50001    1.263    0.000    1.263    0.000 {method 'recv' of
'_socket.socket' objects}
   50000    1.112    0.000    1.112    0.000 {method 'insert' of 'list'
objects}
   50001    0.137    0.000    1.490    0.000 Client.py:16(read_int)
   50001    0.134    0.000    2.478    0.000 Client.py:8(send_int)
       1    0.082    0.082    2.685    2.685 Client.py:19(read_int_list)
   50001    0.077    0.000    0.077    0.000 struct.py:54(pack)
   50001    0.073    0.000    0.089    0.000 struct.py:77(unpack)
       1    0.044    0.044    2.522    2.522 Client.py:11(send_int_list)
   50001    0.016    0.000    0.016    0.000 {method 'unpack' of
'Struct' objects}

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue3766>
_______________________________________


More information about the Python-bugs-list mailing list