-
Notifications
You must be signed in to change notification settings - Fork 48
Description
Hi, i would like to use Nil.JS for making application logic scriptable in a web application (asp.net mvc).
And here i've got a design question - how to manage the Nil.JS context instances. I want to have a separate script runtime context for each executing web request, so the scripts can execute independently. But at the same time i have some variables, functions and libraries that are common to all these scripts and could be shared between them - something like a global context for the application scripts.
Here i'm not sure if i can have one global context for the entire application and only create child contexts per each request, or if i should have separate global context for each executing thread. What happens if child context from multiple threads access the same global context?
My motivation for a shared global context is mostly performance - it requires some time to parse all the libraries and global/shared code so i'd like to avoid doing that for every request.
So what do you recommend - one shared global context, or one global context per thread, or maybe some pool of reusable global contexts that get assigned to a single thread at a time and then returned to the pool?
Thanks
RG