<br>That did it, thank you.  My ignorance at the .NET framework shows itself.  with the test app it now executes at around 0.88 seconds vs the 1.6 for the script version.  And I feel silly for spending some time adding a splash screen to the app as it just disappears in under a second.<br>

<br><div class="gmail_quote">On Thu, Sep 2, 2010 at 10:49 AM, Curt Hagenlocher <span dir="ltr">&lt;<a href="mailto:curt@hagenlocher.org">curt@hagenlocher.org</a>&gt;</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;">

<div>What if you NGEN the executable produced by pyc?</div>
<div> </div>
<div>JIT can make startup expensive, and you&#39;re probably getting the adaptive interpreter when running against ipy.exe.<br></div><div><div></div><div class="h5">
<div class="gmail_quote">On Thu, Sep 2, 2010 at 10:03 AM, Doug Warren <span dir="ltr">&lt;<a href="mailto:doug.warren@gmail.com" target="_blank">doug.warren@gmail.com</a>&gt;</span> wrote:<br>
<blockquote style="border-left: 1px solid rgb(204, 204, 204); margin: 0px 0px 0px 0.8ex; padding-left: 1ex;" class="gmail_quote">That is the case, I made the change you suggested and it reduced the time from 22 seconds to 4, but that&#39;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">&lt;<a href="mailto:dinov@microsoft.com" target="_blank">dinov@microsoft.com</a>&gt;</span> wrote:<br>
<blockquote style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;" class="gmail_quote">The only thing I can think of is if you&#39;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&#39;ll load on the 64-bit CLR.<br>


<br>If that&#39;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&#39;m not sure what would cause this - I get the same times on my<br>(32-bit) laptop when running:<br>


<br>Measure-Command { &amp; &#39;.\ipy.exe&#39; .\time.py }<br>       And<br>Measure-Command { &amp; .\time.exe }<br><br>From powershell.<br>
<div>
<div></div>
<div><br>&gt; -----Original Message-----<br>&gt; From: <a href="mailto:users-bounces@lists.ironpython.com" target="_blank">users-bounces@lists.ironpython.com</a> [mailto:<a href="mailto:users-" target="_blank">users-</a><br>


&gt; <a href="mailto:bounces@lists.ironpython.com" target="_blank">bounces@lists.ironpython.com</a>] On Behalf Of Doug Warren<br>&gt; Sent: Wednesday, September 01, 2010 11:11 AM<br>&gt; To: <a href="mailto:Users@lists.ironpython.com" target="_blank">Users@lists.ironpython.com</a><br>


&gt; Subject: [IronPython] Why is IronPython so much slower to import<br>&gt; modules when built as an exe then as a script?<br>&gt;<br>&gt; I wrote a small script for work and when developing it everything was<br>&gt; fine but<br>


&gt; when I turned it over for production use people complained about the<br>&gt; time it<br>&gt; took to display the first form.  Looking into it, all the time seemed<br>&gt; to be<br>&gt; spent in importing various modules used by the script.  I made a new<br>


&gt; script<br>&gt; of just the import statements and a print Hello World and then ran it<br>&gt; both as<br>&gt; a python script and an executable with the results below.  What&#39;s going<br>&gt; on and<br>&gt; is there any way to speed this up?<br>


&gt;<br>&gt;<br>&gt; Python file:<br>&gt; $ for i in {1..10}<br>&gt; &gt; do<br>&gt; &gt;   time ./ipy.exe time.py<br>&gt; &gt; done<br>&gt; real    0m1.712s<br>&gt; real    0m1.701s<br>&gt; real    0m1.689s<br>&gt; real    0m1.691s<br>


&gt; real    0m1.709s<br>&gt; real    0m1.663s<br>&gt; real    0m1.697s<br>&gt; real    0m1.700s<br>&gt; real    0m1.699s<br>&gt; real    0m1.741s<br>&gt;<br>&gt; exe built with ipy pyc.py /main:time.py /target:exe<br>&gt; $ for i in {1..10}<br>


&gt; &gt; do<br>&gt; &gt;   time ./time.exe | grep -v user | grep -v sys<br>&gt; &gt; done<br>&gt; real    0m22.119s<br>&gt; real    0m22.116s<br>&gt; real    0m22.133s<br>&gt; real    0m21.816s<br>&gt; real    0m21.985s<br>


&gt; real    0m21.785s<br>&gt; real    0m22.010s<br>&gt; real    0m21.686s<br>&gt; real    0m21.877s<br>&gt; real    0m21.944s<br>&gt;<br>&gt; contents of time.py:<br>&gt; import clr<br>&gt; from clr import AddReference<br>


&gt; AddReference(&quot;System.Windows.Forms&quot;)<br>&gt; AddReference(&quot;System.Drawing&quot;)<br>&gt; AddReference(&quot;p4api&quot;)<br>&gt; import cgi<br>&gt; from System.Diagnostics import Process<br>&gt; from P4API import *<br>


&gt; import System<br>&gt; from System import *<br>&gt; from System.Windows.Forms import *<br>&gt; from System.ComponentModel import *<br>&gt; from System.Drawing import *<br>&gt; from System.Threading import *<br>&gt; import re<br>


&gt; import urllib<br>&gt; import os<br>&gt; import tokenize<br>&gt; from cStringIO import StringIO<br>&gt; from optparse import OptionParser<br>&gt; import os<br>&gt; import urllib<br>&gt; import ntpath<br>&gt; import stat<br>


&gt; import genericpath<br>&gt; import warnings<br>&gt; import linecache<br>&gt; import types<br>&gt; import UserDict<br>&gt; import _abcoll<br>&gt; import abc<br>&gt; import textwrap<br>&gt; import string<br>&gt; import urlparse<br>


&gt; import collections<br>&gt; import keyword<br>&gt; import nturl2path<br>&gt; import mimetools<br>&gt; import tempfile<br>&gt; import random<br>&gt; import __future__<br>&gt; import rfc822<br>&gt; import tokenize<br>&gt; import token<br>


&gt; import codecs<br>&gt; import ConfigParser<br>&gt; import uuid<br>&gt; import sys<br>&gt;<br>&gt; print &quot;Hello World&quot;<br></div></div>&gt; _______________________________________________<br>&gt; Users mailing list<br>


&gt; <a href="mailto:Users@lists.ironpython.com" target="_blank">Users@lists.ironpython.com</a><br>&gt; <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" target="_blank">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><br>_______________________________________________<br>Users mailing list<br><a href="mailto:Users@lists.ironpython.com" target="_blank">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></blockquote></div><br>
</div></div><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>
<br></blockquote></div><br>