开发者

IronPython: How many script engines should I have?

Generally speaking, should I keep one ScriptEngine for the life of the application or should I create a开发者_JAVA百科nd destroy them as needed?


One ScriptEngine per AppDomain is fine. To isolate your scripts, make sure that each one is executed in its own ScriptScope. By reusing the ScriptEngine, IronPython won't have to recompile any imported modules, which is generally the slowest part of IronPython, especially if they are short-running scripts.


I would definitely try to limit the number of script engines you instantiate. It is a slow process (from my experience), so the fewer times you have to wait for it, the better.

On that note, I would be careful with only 1. I think that scripts might (just might) have the potential to interfere with eachother if you have 1. I'm not sure, but just be careful.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜