-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
perf(core): don't access isolate slots for JsRuntimeState #16376
Conversation
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.
Does this have any effect on startup time? Not that all the RC copying should be that impactful.
} | ||
} | ||
|
||
pub(crate) fn event_loop_pending_state_from_isolate( |
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.
It'd be great to somehow get rid of this duplication, especially since when we reland realms this code will be more complicated since it needs to check the realm state and module map from every realm. For example, the logic here could be moved to an EventLoopPendingState::new(&mut JsRuntimeState, &ModuleMap)
.
PR denoland#16376 duplicated the definition of `JsRuntime::event_loop_pending_state` into a new method `JsRuntime::event_loop_pending_state_from_isolate`, which just changes how the state and module map are borrowed, as an optimization to avoid accessing isolate slots. This change deduplicates the logic of these two methods into `EventLoopPendingState::new`, which takes borrows of the arguments, making this much more future-proof.
example writeFile benchmark: