-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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(compile): pass module source data from binary directly to v8 #26494
perf(compile): pass module source data from binary directly to v8 #26494
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.
LGTM!
npmrc: Arc::new(ResolvedNpmRc { | ||
default_config: deno_npm::npm_rc::RegistryConfigWithUrl { | ||
registry_url: npm_registry_url.clone(), | ||
config: Default::default(), | ||
}, | ||
scopes: Default::default(), | ||
registry_configs: Default::default(), | ||
}), |
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.
I still don't understand why we need an npmrc
here :D I think it should be fine to have a "noop" npmrc that errors when it's actually used?
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 use a global cache that's located in the binary and we use the provided npm registry url here to resolve the packages.
bytes.extend_from_slice(data); | ||
} | ||
|
||
let mut bytes = Vec::new(); |
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.
Please pre-allocate this vector here
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.
I think it's not worth the complexity because this is just for serializing and I doubt it will have much perf impact. Maybe if we see it on a flamegraph?
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.
Sure
// 4. VFS | ||
let (input, data) = read_bytes_with_len(input).context("vfs")?; | ||
let vfs_dir: VirtualDirectory = | ||
serde_json::from_slice(data).context("deserializing vfs data")?; |
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.
FYI in deno_core
we use https://crates.io/crates/bincode to serialize snapshot, maybe it would be useful in this PR?
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.
Yeah, I think we should do it in the future.
…6494) This changes denort to pass a static reference of the moude source bytes found in the binary to v8 instead of copying it.
Deno compile
errors when ancestor directory is windows junction with target on separate drive
#26316
This introduced a bug that I reported in #26583. |
This changes
denort
to pass a static reference of the moude source bytes found in the binary to v8 instead of copying it.Memory Usage (Example 1)
Memory Usage (Example 2)
Performance
Files
It's faster in many scenarios, but seems slower for the test running many JSR modules. I looked at a flamegraph and it seems to be due to denoland/deno_core#942