[Twisted-Python] Slow PB imports

Itamar Turner-Trauring itamar at itamarst.org
Wed Nov 2 08:36:10 EDT 2011

On Wed, 2011-11-02 at 10:34 +0100, Marcel Gädigk wrote:
> Hi,
> i using the Perspective Broker and i have problems with the speed of 
> importing the modules.
> It takes 15 - 17 seconds for importing the Reactor and the 
> PBServerFactory (or other pb imports).
> If i import the reactor or the pb imports alone it takes in avg. 2-3 
> seconds.

The example script you gave takes me 3.3 seconds to run, on a similar
machine on Linux. So switching operating systems may be one solution :)
If not:

0. Is Twisted on a network filesystem? That may be the problem.

1. Make sure you have .pyc in your installed Twisted directories. If you
don't, you import all of Twisted with a user that has permissions to
create them in those folders.

2. Maybe try a packaging Twisted in an .egg file.

More information about the Twisted-Python mailing list