-
Notifications
You must be signed in to change notification settings - Fork 309
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add an option to newContext to disable memoization of global context … #2999
Conversation
1afc837
to
8e026ba
Compare
@@ -527,14 +533,15 @@ template <typename TypeWrapper, | |||
const char* methodName, | |||
typename Method, | |||
Method method, | |||
bool isContext> | |||
bool isContext, | |||
bool memoize> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Non-blocking nit... really not a big fan of bool args like this. Much prefer enums for this type of case. Won't block on it tho
8e026ba
to
d4d60d7
Compare
@jasnell is this good to go? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes LGTM assuming this is the cleanest way to achieve what we need. I don't have a lot of context on this code so will leave to someone else to approve.
// | ||
// When creating a new context the global context template will be memoized for future reuse in | ||
// additional contexts. The global context can depend on `configuration`. For Python Isolate | ||
// Pools we want to create a new context and initialize some code in it and later when a request | ||
// arrives, edit the configuration and create a new context. To achieve this we create the first | ||
// context with `memoize=false` to disable memoization of the global context created for the | ||
// first context. Then we create a new context with `memoize=true` to enable memoization of the | ||
// main context created after a request was received. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably a stupid question, but I wonder why we cannot overwrite the memoized context after it has been memoized?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That would require the inverse of the same logic changing the code flow that existed before this change rather than adding a different code flow for our exceptional case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM but there's a merge conflict and let's be sure to run an internal CI job before merging to make sure there are no issues on the internal repo
…template. For Python Isolate Pools we want to instantiate emscripten in a separate context on isolate creation (before we have compatibility flags) and later after receiving the compatibility flags create a new context. One blocker to this approach is all the templates that are instantiated in the first context are memoized. This PR allows us to create a new context without memoizing the global context templates. This feature is off by default and will be enabled in a future PR for python isolates only.
d4d60d7
to
57365ba
Compare
…template.
For Python Isolate Pools we want to instantiate emscripten in a separate context on isolate creation (before we have compatibility flags) and later after receiving the compatibility flags create a new context.
One blocker to this approach is all the templates that are instantiated in the first context are memoized.
This PR allows us to create a new context without memoizing the global context templates.
This feature is off by default and will be enabled in a future PR for python isolates only.