I'm guessing that the slowdown comes from the fact that calling a method like recv() on the wrapper object is now a Python method which calls the C method on the wrapped object. I wonder if the slowdown can't be easily repaired by changing the wrapper class to copy the relevant methods to instance variables. It would be even nicer to use subclassing instead of a wrapper object. I vaguely recall that I tried this before but couldn't figure out how to do it, but I've got a feeling that it ought to be doable -- after all the C socket object has separate __new__ and __init__ methods. I hope someone can take this ball and submit a patch -- it would indeed be a shame to have to live with the slowdown (even if it only shows up when using the loopback device) or to have a practice of monkey patching socket.py. (BTW instead of monkey-patching socket.py, it might be easier to write "import _socket as socket".) --Guido van Rossum (home page: http://www.python.org/~guido/)
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4