IronPython import time remains much slower than CPython. I think you've seen from the differences between 2.0 and 2.6 that we've already made significant progress in improving this - and we certainly plan to continue pushing on it with each release.
One way to improve startup time today is to use the pyc tool (in Tools\Scripts in the IronPython install) to pre-compile your .py files. -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Marco Parenzan Sent: Thursday, August 20, 2009 8:18 AM To: [email protected] Subject: Re: [IronPython] Performances and Profiling of ReportLab under IronPython Curt, thanks for tip: it's ok. That's the code: __pySearchPaths = new List<string>(Properties.Settings.Default.PySearchPaths.Split(';')); __pyEngine = Python.CreateEngine(); __pyEngine.SetSearchPaths(__pySearchPaths); __pyEngine.ImportModule("reportlab.graphics"); __pyEngine.ImportModule("reportlab.graphics.shapes"); ScriptScope scope = __pyEngine.CreateScope(); ScriptWriter writer = new ScriptWriter(); // an helper class I use to write python code in C# code writer.Clear(); writer.Write("from reportlab.graphics.shapes import Drawing, String"); writer.Write("from reportlab.graphics import renderPDF"); writer.Write("d = Drawing(100, 100)"); writer.Write("s = String(50, 50, 'Hello world', textAlign='middle')"); writer.Write("d.add(s)"); writer.Write(@"renderPDF.drawToFile(d, 'HW.pdf', 'Hello World {0}')"); __pyEngine.Execute(writer.Script(false), scope); About startup time: yes, the first five lines takes 10/11 seconds! With your tip I have solved my problem, but I don't understand the difference between IPY and CPython (1 seconds from start to end). Marco -----Original Message----- Date: Thu, 20 Aug 2009 07:43:08 -0700 From: Curt Hagenlocher <[email protected]> To: Discussion of IronPython <[email protected]> Subject: Re: [IronPython] Performances and Profiling of ReportLab under IronPython Message-ID: <[email protected]> Content-Type: text/plain; charset="windows-1252" Imports are specific to a ScriptEngine. When you create a new ScriptScope through the hosting interface and run "import foo" inside of it, the standard Python behavior applies -- if "foo" is already in sys.modules, it won't be imported again. Instead, the name will just be added to the current scope. When you say "startup time" in this context -- that includes the time it takes to import the modules? _______________________________________________ Users mailing list [email protected] http://lists.ironpython.com/listinfo.cgi/users-ironpython.com _______________________________________________ Users mailing list [email protected] http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
