-
Notifications
You must be signed in to change notification settings - Fork 106
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
refactor: pass hash into code cache #752
refactor: pass hash into code cache #752
Conversation
@@ -275,7 +288,8 @@ impl ModuleLoader for MockLoader { | |||
|
|||
fn code_cache_ready( | |||
&self, | |||
module_specifier: &ModuleSpecifier, | |||
module_specifier: ModuleSpecifier, |
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.
Changed this to an owned value because deno_core has it available without cloning and this can help prevent cloning if someone wants to send this to another thread when saving the code cache.
@@ -275,7 +288,8 @@ impl ModuleLoader for MockLoader { | |||
|
|||
fn code_cache_ready( | |||
&self, | |||
module_specifier: &ModuleSpecifier, | |||
module_specifier: ModuleSpecifier, | |||
_hash: u64, | |||
code_cache: &[u8], | |||
) -> Pin<Box<dyn Future<Output = ()>>> { |
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.
We should look into doing something similar for the script callbacks. I'm just not sure how to convert a Local<String>
to a &str
... maybe deno_core should just create the hash.
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.
You can convert it like so: &x.to_rust_string_lossy(scope)
* denoland/deno_core#752 * denoland/deno_core#753 Did benchmarking on this and it's slightly faster (couple ms) or equal to in performance as main. Closes #23904
This avoids the cli having to re-lookup the hash again.