2

I would like to create an ASP.NET MVC web application which has extensible logic that does not require a re-build. I was thinking of creating a filter which had an instance of the IronPython engine. What I would like to know is: how much overhead is there in creating a new engine during each web request, and would it be a better idea to keep a static engine around? However, if I were to keep a single static engine around, what are the issues I might run into as far as locking and script scope? Is it possible to have multiple scopes in the same IropPython engine so I don't get variable collision and security issues between web requests?

1 Answer 1

3

I've just started using IronPython as extensibility point in my ASP.NET MVC aplication. I have one ipy engine (in static property) and for each request I create new scope and execute the script in that scope.
Each scope should be independent on other scopes, no locking is needed.

If I run into issues, I'll post it here. However, I don't expect any ;)

Sign up to request clarification or add additional context in comments.

1 Comment

This is definitely the recommended approach. ScriptEngine's aren't hugely expensive by themselves but compiling code is pretty expensive. If you re-use the same CompiledCode object you save a lot especially if you have the Python standard libray around which imports about 10 files on startup.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.