[python-win32] Re: high cpu usage in wxPython with Twisted
barry brant
bacondog835710 at yahoo.com
Wed Jul 21 11:44:54 CEST 2004
Don't use ANY of the many variations of the Twisted reactors. They all use some variation of polling, event loop control, etc. Basically they all result in poor performance. I have tried them all (there are about 5 of them).
The way I solved the problem with wxPython is the following: launch the standard reactor (not the special wx one, nor any of the other variations) in a separate background process. Then use Pyro to communicate between them (alternatively you can use XMLRPC or COM or sockets or... anything that handles communication between two programs on the same machine). I used Pyro and it works great. With Pyro, you need to set up the background process as a client and the wxPython application as a server off the main event thread (Pyro works fine on a separate thread). The wxPython program does not communicate directly with Twisted, but rather through the background process. The performance is very good... you really can not tell that the server communication is through another process. Lastly, putting the reactor in a separate process solves the problem of it competing for the main event loop with wx.
---------------------------------
Do you Yahoo!?
Yahoo! Mail - 50x more storage than other providers!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/python-win32/attachments/20040721/fbd50fc7/attachment.html
More information about the Python-win32
mailing list