<div dir="ltr">Hi all,<br><br>I've finally managed to get my code running correctly under IPy2b5 - thanks everyone who helped!<br><br>I'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'm not missing something stupid, like turning on optimizations in the DLR...<br>below is the hosting code I'm using to run the tests. I tried with and without "Debug" flag, and it doesn'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'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> Dictionary<string, object> runtimeOptions = new Dictionary<string, object>();<br> runtimeOptions["Debug"] = true;<br> ScriptRuntime runtime = IronPython.Hosting.Python.CreateRuntime(runtimeOptions);<br>
runtime.LoadAssembly(typeof(String).Assembly); // Add reference to System<br> runtime.LoadAssembly(typeof(Uri).Assembly); // Add reference to mscorlib<br> engine = runtime.GetEngine("Python");<br>
....<br><br>// run file as __main__<br>
engine.SetSearchPaths(new string[] {".", progdir, backend_dir, stdlib_dir});<br>
<br> List argv = new List();<br> argv.append(filename);<br> for (int i = 2; i < args.Length; ++i)<br> argv.append(args[i]);<br> engine.GetSysModule().SetVariable("argv", argv);<br>
<br> mainScope = engine.CreateScope();<br>
mainScope.SetVariable("__name__", "__main__");<br>
var main_module = Microsoft.Scripting.Hosting.Providers.HostingHelpers.GetScope(mainScope);<br>
runtime.Globals.SetVariable("__main__", main_module);<br>
mainScope.SetVariable("__file__",filename);<br>
<br>
ScriptSource source = engine.CreateScriptSourceFromFile(filename, Encoding.Default, SourceCodeKind.Statements);<br> source.Execute(mainScope);<br><br></div>