You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When embedding Python in an ASP.NET MVC 5 web application, PythonEngine.Initialize needs a couple of seconds to eagerly load the names of around 50 module namespaces in ModuleObject.LoadNames. If I replace the implementation of LoadNames with a NOP, time spent in PythonEngine.Initialize drops to below 100 ms and the web application still seems to work.
I don't fully understand the idea of eager initialization of the cache in ModuleObject.LoadNames when other members of ModuleObject use lazy caching. At least in my use case (using only a couple of methods of the 50+ module namespaces) this seems to be a bad tradeoff.
Activity
dmitriyse commentedon Jan 15, 2018
We already have PR for that problem. See #528
Also try to build python.net from the branch https://github.com/pythonnet/pythonnet/tree/featured
This branch contains muptiple not yet merged fixes to the master branch.
goerch commentedon Jan 15, 2018
I don't fully understand the idea of eager initialization of the cache in ModuleObject.LoadNames when other members of ModuleObject use lazy caching. At least in my use case (using only a couple of methods of the 50+ module namespaces) this seems to be a bad tradeoff.
Are there any benchmarks to justify this design?
goerch commentedon Jan 15, 2018
Just tested the branch https://github.com/pythonnet/pythonnet/tree/featured. Response time is down to 200 ms with eager initialization of 50+ module namespaces. Thanks for your help!
pierce-martin commentedon Apr 25, 2018
@dmitriyse When will this fix be incorporated into a release? The branch https://github.com/pythonnet/pythonnet/tree/featured seems to work great, but it doesn't appear that master has these changes. Thanks.
den-run-ai commentedon Nov 14, 2018
this is now in master branch: #723