[IronPython] Why is IronPython so much slower to import modules when built as an exe then as a script?

Doug Warren doug.warren at gmail.com
Thu Sep 2 19:03:14 CEST 2010


That is the case, I made the change you suggested and it reduced the time
from 22 seconds to 4, but that's still 250% the time that the script alone
runs at.

On Wed, Sep 1, 2010 at 9:42 PM, Dino Viehland <dinov at microsoft.com> wrote:

> The only thing I can think of is if you're on a 64-bit OS then ipy.exe is a
> 32-bit
> EXE and the EXE you compiled is platform neutral - so it'll load on the
> 64-bit CLR.
>
> If that's the case you could use pyc.py with /platform:x86 and you should
> get the
> same behavior as ipy.exe.
>
> Other than that I'm not sure what would cause this - I get the same times
> on my
> (32-bit) laptop when running:
>
> Measure-Command { & '.\ipy.exe' .\time.py }
>        And
> Measure-Command { & .\time.exe }
>
> From powershell.
>
> > -----Original Message-----
> > From: users-bounces at lists.ironpython.com [mailto:users-
> > bounces at lists.ironpython.com] On Behalf Of Doug Warren
> > Sent: Wednesday, September 01, 2010 11:11 AM
> > To: Users at lists.ironpython.com
> > Subject: [IronPython] Why is IronPython so much slower to import
> > modules when built as an exe then as a script?
> >
> > I wrote a small script for work and when developing it everything was
> > fine but
> > when I turned it over for production use people complained about the
> > time it
> > took to display the first form.  Looking into it, all the time seemed
> > to be
> > spent in importing various modules used by the script.  I made a new
> > script
> > of just the import statements and a print Hello World and then ran it
> > both as
> > a python script and an executable with the results below.  What's going
> > on and
> > is there any way to speed this up?
> >
> >
> > Python file:
> > $ for i in {1..10}
> > > do
> > >   time ./ipy.exe time.py
> > > done
> > real    0m1.712s
> > real    0m1.701s
> > real    0m1.689s
> > real    0m1.691s
> > real    0m1.709s
> > real    0m1.663s
> > real    0m1.697s
> > real    0m1.700s
> > real    0m1.699s
> > real    0m1.741s
> >
> > exe built with ipy pyc.py /main:time.py /target:exe
> > $ for i in {1..10}
> > > do
> > >   time ./time.exe | grep -v user | grep -v sys
> > > done
> > real    0m22.119s
> > real    0m22.116s
> > real    0m22.133s
> > real    0m21.816s
> > real    0m21.985s
> > real    0m21.785s
> > real    0m22.010s
> > real    0m21.686s
> > real    0m21.877s
> > real    0m21.944s
> >
> > contents of time.py:
> > import clr
> > from clr import AddReference
> > AddReference("System.Windows.Forms")
> > AddReference("System.Drawing")
> > AddReference("p4api")
> > import cgi
> > from System.Diagnostics import Process
> > from P4API import *
> > import System
> > from System import *
> > from System.Windows.Forms import *
> > from System.ComponentModel import *
> > from System.Drawing import *
> > from System.Threading import *
> > import re
> > import urllib
> > import os
> > import tokenize
> > from cStringIO import StringIO
> > from optparse import OptionParser
> > import os
> > import urllib
> > import ntpath
> > import stat
> > import genericpath
> > import warnings
> > import linecache
> > import types
> > import UserDict
> > import _abcoll
> > import abc
> > import textwrap
> > import string
> > import urlparse
> > import collections
> > import keyword
> > import nturl2path
> > import mimetools
> > import tempfile
> > import random
> > import __future__
> > import rfc822
> > import tokenize
> > import token
> > import codecs
> > import ConfigParser
> > import uuid
> > import sys
> >
> > print "Hello World"
> > _______________________________________________
> > Users mailing list
> > Users at lists.ironpython.com
> > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
> _______________________________________________
> Users mailing list
> Users at lists.ironpython.com
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20100902/8094afc5/attachment.html>


More information about the Ironpython-users mailing list