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