diff options
author | Martin v. Löwis <martin@v.loewis.de> | 2011-06-06 08:25:55 (GMT) |
---|---|---|
committer | Martin v. Löwis <martin@v.loewis.de> | 2011-06-06 08:25:55 (GMT) |
commit | 2d449aa0040b84b833a4e76680056f543eecb93f (patch) | |
tree | d460de6ebe918bbbd1d98db8cf34b395b140904c /Doc/howto | |
parent | f0cdbad1b3c8b962c2bdce9ced843d7576db1810 (diff) | |
download | cpython-2d449aa0040b84b833a4e76680056f543eecb93f.zip cpython-2d449aa0040b84b833a4e76680056f543eecb93f.tar.gz cpython-2d449aa0040b84b833a4e76680056f543eecb93f.tar.bz2 |
Drop unfounded claims about performance.
Diffstat (limited to 'Doc/howto')
-rw-r--r-- | Doc/howto/sockets.rst | 28 |
1 files changed, 1 insertions, 27 deletions
diff --git a/Doc/howto/sockets.rst b/Doc/howto/sockets.rst index 2416807..0591e94 100644 --- a/Doc/howto/sockets.rst +++ b/Doc/howto/sockets.rst @@ -386,32 +386,6 @@ determining whether the other end is done, or just busy with something else. files. Don't try this on Windows. On Windows, ``select`` works with sockets only. Also note that in C, many of the more advanced socket options are done differently on Windows. In fact, on Windows I usually use threads (which work -very, very well) with my sockets. Face it, if you want any kind of performance, -your code will look very different on Windows than on Unix. +very, very well) with my sockets. -Performance ------------ - -There's no question that the fastest sockets code uses non-blocking sockets and -select to multiplex them. You can put together something that will saturate a -LAN connection without putting any strain on the CPU. The trouble is that an app -written this way can't do much of anything else - it needs to be ready to -shuffle bytes around at all times. - -Assuming that your app is actually supposed to do something more than that, -threading is the optimal solution, (and using non-blocking sockets will be -faster than using blocking sockets). Unfortunately, threading support in Unixes -varies both in API and quality. So the normal Unix solution is to fork a -subprocess to deal with each connection. The overhead for this is significant -(and don't do this on Windows - the overhead of process creation is enormous -there). It also means that unless each subprocess is completely independent, -you'll need to use another form of IPC, say a pipe, or shared memory and -semaphores, to communicate between the parent and child processes. - -Finally, remember that even though blocking sockets are somewhat slower than -non-blocking, in many cases they are the "right" solution. After all, if your -app is driven by the data it receives over a socket, there's not much sense in -complicating the logic just so your app can wait on ``select`` instead of -``recv``. - |