[IronPython] Multi threaded engine
Jeff Hardy
jdhardy at gmail.com
Mon Jun 7 17:08:44 CEST 2010
On Mon, Jun 7, 2010 at 7:14 AM, Christos Pavlides <ncichris at gmail.com> wrote:
> I am thinking that it could be better if the ScriptEngine and CompiledCode
> are thread safe, and if I create one static engine an one static
> CompliledCode then this will minimize the compile time since the rules will
> have to be compiled one time and then reused for all threads.
My understanding is that this is the case - for NWSGI I use a single
engine (per AppDomain, but that's not important) and each script is
compiled once into a CompiledCode object. On each request it gets a
new scope from the engine, finds the CompiledCode for the requested
script, and executes it in that scope. IIS can have a lot of worker
threads handling requests at any time, so it's basically the same
scenario you have. As long as you don't reuse scopes (and they're very
cheap to create) you should be just fine.
- Jeff
More information about the Ironpython-users
mailing list