[prev in list] [next in list] [prev in thread] [next in thread] 

List:       py2exe-users
Subject:    [Py2exe-users] Executable is slower than code run from the
From:       Massimiliano Costacurta <massi_srb () msn ! com>
Date:       2011-06-09 9:35:42
Message-ID: DUB106-ds71143F5044FA523DBBCB89C650 () phx ! gbl
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


Hi everyone, 
I'm writing a big program (windows 7, python 2.6.6) which includes 
lots of python libraries (SQLalchemy, PyQt, SocketServer, 
Matplotlib,...). Now I'm trying to build a stand alone executable with 
py2exe (0.6.9) and everything works great. The only issue is that the 
executable seems to be slower with respect to the same code run from 
Idle. 
For example, at stratup my program sets up a server and during the 
execution sends commands to it and waits for reply. In the code case 
the average time needed to process a given command is 0.24s, in the 
executable case it raises to 0.30 (times are obviously measured 
considering the same command). 
It is really difficult for me to build a small example script to show 
the problem, so I guess if anyone knows if there are some issues in 
py2exe that could bring such a performance loss. Here is the code of my 
setup.py script:

from distutils.core import setup
import py2exe 
import matplotlib as mpl
import glob, shutil

mpl.use('Qt4Agg')
shutil.rmtree("build", ignore_errors=True)
                             
includes = ['sip', "PyQt4",
            "matplotlib.backends",  
            "matplotlib.backends.backend_qt4agg",
            "win32com", "win32service", "win32serviceutil", "win32event",
            "sqlalchemy.dialects.mssql", "pyodbc", "datetime", "decimal",
            "sqlalchemy.dialects.mysql", "MySQLdb",
            "sqlalchemy.dialects.sqlite"]
excludes = ['_gtkagg', '_tkagg', '_ps', '_fltkagg', 'Tkinter', 'Tkconstants', 
            '_cairo', '_gtk', 'gtkcairo', 'pydoc', 'bsddb', 'curses', '_agg', 
            'tcl', '_wxagg', '_gtagg', '_cocoaagg', '_wx']
packages = ['matplotlib', 'pytz', "encodings"]
dll_excludes = ['libgdk-win32-2.0-0.dll', 'libgobject-2.0-0.dll', 'tcl84.dll',
                "libgdk_pixbuf-2.0-0.dll", 'tk84.dll']
data_files = mpl.get_py2exe_datafiles()

setup(name="MyProg",
      console=[{"script": 'MyProg.pyw',
                "icon_resources": [(1, "color.ico")]}],
      options = {"py2exe": {
                            "compressed":2,
                            "optimize":2, 
                            "includes":includes,
                            "excludes":excludes,
                            "packages":packages, 
                            "dll_excludes":dll_excludes,
                            "bundle_files":2,
                            "dist_dir":'dist', 
                            "xref":False, 
                            "skip_archive":False, 
                            "ascii": False, 
                            "custom_boot_script":''
                            }},
      zipfile = r'lib\library.zip',
      data_files=data_files
)


Any hint is welcome, 
thanks! 

[Attachment #5 (text/html)]

<HTML><HEAD></HEAD>
<BODY dir=ltr>
<DIV dir=ltr>
<DIV style="FONT-FAMILY: 'Calibri'; COLOR: #000000; FONT-SIZE: 12pt">
<DIV><FONT class=fixed_width>Hi everyone, <BR>I'm writing a big program (windows 
7, python 2.6.6) which includes <BR>lots of python libraries (SQLalchemy, PyQt, 
SocketServer, <BR>Matplotlib,...). Now I'm trying to build a stand alone 
executable with <BR>py2exe (0.6.9) and everything works great. The only issue is 
that the <BR>executable seems to be slower with respect to the same code run 
from <BR>Idle. <BR>For example, at stratup my program sets up a server and 
during the <BR>execution sends commands to it and waits for reply. In the code 
case <BR>the average time needed to process a given command is 0.24s, in the 
<BR>executable case it raises to 0.30 (times are obviously measured 
<BR>considering the same command). <BR>It is really difficult for me to build a 
small example script to show <BR>the problem, so I guess if anyone knows if 
there are some issues in <BR>py2exe that could bring such a performance loss. 
Here is the code of my </FONT></DIV>
<DIV>setup.py script:</DIV>
<DIV>&nbsp;</DIV>
<DIV>from distutils.core import setup</DIV>
<DIV>import py2exe </DIV>
<DIV>import matplotlib as mpl</DIV>
<DIV>import glob, shutil</DIV>
<DIV>&nbsp;</DIV>
<DIV>mpl.use('Qt4Agg')</DIV>
<DIV>shutil.rmtree("build", ignore_errors=True)</DIV>
<DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb \
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
 </DIV>
<DIV>includes = ['sip', "PyQt4",</DIV>
<DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
"matplotlib.backends",&nbsp; </DIV>
<DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
"matplotlib.backends.backend_qt4agg",</DIV>
<DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
"win32com", "win32service", "win32serviceutil", "win32event",</DIV>
<DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
"sqlalchemy.dialects.mssql", "pyodbc", "datetime", "decimal",</DIV>
<DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
"sqlalchemy.dialects.mysql", "MySQLdb",</DIV>
<DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
"sqlalchemy.dialects.sqlite"]</DIV>
<DIV>excludes = ['_gtkagg', '_tkagg', '_ps', '_fltkagg', 'Tkinter', 
'Tkconstants', </DIV>
<DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
'_cairo', '_gtk', 'gtkcairo', 'pydoc', 'bsddb', 'curses', '_agg', </DIV>
<DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 'tcl', 
'_wxagg', '_gtagg', '_cocoaagg', '_wx']</DIV>
<DIV>packages = ['matplotlib', 'pytz', "encodings"]</DIV>
<DIV>dll_excludes = ['libgdk-win32-2.0-0.dll', 'libgobject-2.0-0.dll', 
'tcl84.dll',</DIV>
<DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
 "libgdk_pixbuf-2.0-0.dll", 'tk84.dll']</DIV>
<DIV>data_files = mpl.get_py2exe_datafiles()</DIV>
<DIV>&nbsp;</DIV>
<DIV>setup(name="MyProg",</DIV>
<DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; console=[{"script": 'MyProg.pyw',</DIV>
<DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
 "icon_resources": [(1, "color.ico")]}],</DIV>
<DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; options = {"py2exe": {</DIV>
<DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb \
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  \
"compressed":2,</DIV> \
<DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb \
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  \
"optimize":2, </DIV> \
<DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb \
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n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p;&nbsp;&nbsp;&nbsp;&nbsp;&nb \
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  \
"xref":False, </DIV> \
<DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb \
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  \
"skip_archive":False, </DIV> \
<DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb \
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  \
"ascii": False, </DIV> \
<DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb \
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  \
"custom_boot_script":''</DIV> \
<DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb \
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  \
}},</DIV> <DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; zipfile = r'lib\library.zip',</DIV>
<DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; data_files=data_files</DIV>
<DIV>)</DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT class=fixed_width></FONT>&nbsp;</DIV>
<DIV><FONT class=fixed_width>Any hint is welcome, <BR>thanks! 
<BR></DIV></FONT></DIV></DIV></BODY></HTML>



------------------------------------------------------------------------------
EditLive Enterprise is the world's most technically advanced content
authoring tool. Experience the power of Track Changes, Inline Image
Editing and ensure content is compliant with Accessibility Checking.
http://p.sf.net/sfu/ephox-dev2dev

_______________________________________________
Py2exe-users mailing list
Py2exe-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/py2exe-users


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic