[IronPython] IPyb5 performance
Ronnie Maor
ronnie.maor at gmail.com
Sun Sep 28 08:21:55 CEST 2008
Hi all,
I've finally managed to get my code running correctly under IPy2b5 - thanks
everyone who helped!
I'm now left with a performance problem. My code seems to run roughly 2
times slower:
* infra tests regressed from 19 seconds in IPy 1.1.1 to 33 seconds in IPy2b5
* application level tests regressed from 375 seconds in 1.1.1 to 705 seconds
in IPy2b5
(these are single measurements, but variance is not too big - about 5%)
startup time is also much longer, but I can live with that.
before trying to pinpoint the bottlenecks, I wanted to check I'm not missing
something stupid, like turning on optimizations in the DLR...
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.
Is there something else I should be doing? any tips?
thanks!
// set up runtime and engine
Dictionary<string, object> runtimeOptions = new
Dictionary<string, object>();
runtimeOptions["Debug"] = true;
ScriptRuntime runtime =
IronPython.Hosting.Python.CreateRuntime(runtimeOptions);
runtime.LoadAssembly(typeof(String).Assembly); // Add reference
to System
runtime.LoadAssembly(typeof(Uri).Assembly); // Add reference to
mscorlib
engine = runtime.GetEngine("Python");
....
// run file as __main__
engine.SetSearchPaths(new string[] {".", progdir, backend_dir,
stdlib_dir});
List argv = new List();
argv.append(filename);
for (int i = 2; i < args.Length; ++i)
argv.append(args[i]);
engine.GetSysModule().SetVariable("argv", argv);
mainScope = engine.CreateScope();
mainScope.SetVariable("__name__", "__main__");
var main_module =
Microsoft.Scripting.Hosting.Providers.HostingHelpers.GetScope(mainScope);
runtime.Globals.SetVariable("__main__", main_module);
mainScope.SetVariable("__file__",filename);
ScriptSource source =
engine.CreateScriptSourceFromFile(filename, Encoding.Default,
SourceCodeKind.Statements);
source.Execute(mainScope);
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20080928/7b5f3543/attachment.html>
More information about the Ironpython-users
mailing list