[IronPython] Multi threaded engine

Christos Pavlides ncichris at gmail.com
Tue Jun 8 07:20:13 CEST 2010

Thanks Dino and Jeff,
You guys are great, I was not expecting these fast responses.

Thanks again, I will do a number of changes based on your comments and see
if I have any issues.

-----Original Message-----
From: users-bounces at lists.ironpython.com
[mailto:users-bounces at lists.ironpython.com] On Behalf Of Dino Viehland
Sent: Tuesday, June 08, 2010 12:30 AM
To: Discussion of IronPython
Subject: Re: [IronPython] Multi threaded engine

Christos wrote:
> Thanks Jeff,
> This is the recommendation I was expecting to get.
> I will run a high concurrency test on a single engine and single
> compiled
> code, with new scopes for each request and see where it takes me.
> Do I need any locks on the engine itself when Getting the scope (which
> could
> be called from many threads at the same time)?

Nope - no locks required.

> I have another question related to performance.
> Right now I have a number of parameters that I need to pass to the
> CompiledCode and I use Microsoft.Scripting.ScopeStorage.SetValue and
> then
> create the scope using this.
> Is there a more efficient way to pass parameters to the CompiledCode?
> Like
> creating an single "parameter" object which is well known by both the
> IronPython code and my C# code?

The best way is to create the storage for the scope yourself.  Right now
the simplest (and sure to work) way to do that is to implement
and create a scope using that for the storage.  Then you can respond to
the lookups lazily.  But setting multiple variables on a scope shouldn't
be that expensive (at least in 2.6.1 - there were some issues w/ that in 
Users mailing list
Users at lists.ironpython.com

More information about the Ironpython-users mailing list