<div dir="ltr">Hi all,<br><br>I&#39;ve finally managed to get my code running correctly under IPy2b5 - thanks everyone who helped!<br><br>I&#39;m now left with a performance problem. My code seems to run roughly 2 times slower:<br>

* infra tests regressed from 19 seconds in IPy 1.1.1 to 33 seconds in IPy2b5<br>* application level tests regressed from 375 seconds in 1.1.1 to 705 seconds  in IPy2b5<br>(these are single measurements, but variance is not too big - about 5%)<br>
startup time is also much longer, but I can live with that.<br><br>before trying to pinpoint the bottlenecks, I wanted to check I&#39;m not missing something stupid, like turning on optimizations in the DLR...<br>below is the hosting code I&#39;m using to run the tests. I tried with and without &quot;Debug&quot; flag, and it doesn&#39;t seem to change anything (except debug allows me to understand the stack traces). I can also run the infra tests with ipy directly, which showed that -O and -OO don&#39;t help either.<br>
<br>Is there something else I should be doing? any tips?<br>thanks!<br><br>
// set up runtime and engine<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Dictionary&lt;string, object&gt; runtimeOptions = new Dictionary&lt;string, object&gt;();<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; runtimeOptions[&quot;Debug&quot;] = true;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ScriptRuntime runtime = IronPython.Hosting.Python.CreateRuntime(runtimeOptions);<br>

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; runtime.LoadAssembly(typeof(String).Assembly); // Add reference to System<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; runtime.LoadAssembly(typeof(Uri).Assembly); // Add reference to mscorlib<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; engine = runtime.GetEngine(&quot;Python&quot;);<br>

....<br><br>// run file as __main__<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; engine.SetSearchPaths(new string[] {&quot;.&quot;, progdir, backend_dir, stdlib_dir});<br>
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; List argv = new List();<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; argv.append(filename);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; for (int i = 2; i &lt; args.Length; ++i)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; argv.append(args[i]);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; engine.GetSysModule().SetVariable(&quot;argv&quot;, argv);<br>

<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; mainScope = engine.CreateScope();<br>

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; mainScope.SetVariable(&quot;__name__&quot;, &quot;__main__&quot;);<br>

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; var main_module = Microsoft.Scripting.Hosting.Providers.HostingHelpers.GetScope(mainScope);<br>

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; runtime.Globals.SetVariable(&quot;__main__&quot;, main_module);<br>

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; mainScope.SetVariable(&quot;__file__&quot;,filename);<br>

<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ScriptSource source = engine.CreateScriptSourceFromFile(filename, Encoding.Default, SourceCodeKind.Statements);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; source.Execute(mainScope);<br><br></div>