I would recommend: Keep 1 ScriptRuntime/ScriptEngine (as Jimmy mentions you can repeatedly grab the SE off the SR) Compile the code to a CompiledCode object and repeatedly execute it rather than re-compiling and executing Create a new ScriptScope for each request
That's basically what the ASP.NET integration for IronPython does. > -----Original Message----- > From: users-boun...@lists.ironpython.com [mailto:users- > boun...@lists.ironpython.com] On Behalf Of Jimmy Schementi > Sent: Tuesday, February 02, 2010 9:53 AM > To: Discussion of IronPython; ironruby-c...@rubyforge.org > Subject: Re: [IronPython] Hosting DLR under ASP.NET > > Recreating them on each call is OK for really simple script usages, since > multiple requests of an ASP.NET app run in the same CLR instance, and the > result of ScriptRuntime.GetEngine("langName") is cached, so the app will only > incur a performance hit (because of the language's assemblies JITing) on the > first request. However, if you want to keep some state around, let's say by > defining some functions or importing a library for your script code to use, > then you'll want to at least keep track of a ScriptScope, and then you might > as well keep track of a ScriptEngine as well. You can store those anywhere > you'd normally store things that need to persist between requests. > > ~js > > > -----Original Message----- > > From: users-boun...@lists.ironpython.com [mailto:users- > > boun...@lists.ironpython.com] On Behalf Of Marco Parenzan > > Sent: Tuesday, February 02, 2010 5:09 AM > > To: ironruby-c...@rubyforge.org; users@lists.ironpython.com > > Subject: [IronPython] Hosting DLR under ASP.NET > > > > Dear All, > > > > are there any advices about hosting DLR under ASP.NET for scripting? (not > for > > views!)? > > Where hosting ScriptingRuntime, ScriptingEngine? > > As static variables in Global.asax? In Application? > > Where hosting ScriptingScope? In Session? Destroy and reistantiate at each > > call? > > > > I have to develop an ASP.NET MVC application, with no serious performance > > issues, but I don't want to abuse... > > > > Thanks in advance > > > > Marco Parenzan > > > > _______________________________________________ > > Users mailing list > > Users@lists.ironpython.com > > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > _______________________________________________ > Users mailing list > Users@lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com _______________________________________________ Users mailing list Users@lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com