object references/memory access

"Martin v. Löwis" martin at v.loewis.de
Sun Jul 1 16:01:54 EDT 2007


> I guess now I'd like to know what are good practices in general to get
> better results with sockets on the same local machine. I'm only
> instantiating two sockets total right now - one client and one server,
> and the transfer is taking 15 seconds for only 8.3MB.

It would be good if you had showed the code that does that. It is hard
for us to guess what programming error you have made.

As you won't show code, I will. Please try the attached cli.py and
server.py on your machine, and report the timing. On my machine, I get

0.00105595588684 0.076632976532 8300000

which means I can transmit 8.3MB in 76ms, which is a lot less than
15s.

My guess is that you sum up the incoming data with

  total_data += received_data

That is O(n**2).

Regards,
Martin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cli.py
Type: text/x-python
Size: 329 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/python-list/attachments/20070701/444c06ee/attachment.py>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: server.py
Type: text/x-python
Size: 192 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/python-list/attachments/20070701/444c06ee/attachment-0001.py>


More information about the Python-list mailing list