-
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: analyze cjs exports and emit typescript in parallel #23856
Conversation
@@ -113,6 +117,7 @@ impl<TCjsCodeAnalyzer: CjsCodeAnalyzer> NodeCodeTranslator<TCjsCodeAnalyzer> { | |||
reexports_to_handle.push_back((reexport, specifier.clone())); | |||
} | |||
|
|||
// todo(dsherret): we could run this analysis concurrently in a FuturesOrdered |
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.
This is a future perf improvement. Opened #23859
&self, | ||
graph: &ModuleGraph, | ||
) -> Result<(), AnyError> { | ||
// todo(dsherret): we could do this concurrently |
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.
Another future perf improvement #23860
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
} | ||
} | ||
|
||
fn load_prepared_module_sync( |
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.
Is this temporary or will we always need both sync and async versions?
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.
Source map lookup is sync, so we'll probably need this unless we move the spawn blocking to a higher level (I investigated doing this just now, and the performance is equivalent, but it means that all our code in the worker needs to be Send/Sync, which is something I don't think we want to do)
deno_core::ModuleLoadResponse::Async( | ||
async move { | ||
inner | ||
.load_inner( | ||
&specifier, |
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.
Very cool 👍
tests/integration/inspector_tests.rs
Outdated
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.
Drive-by fix?
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.
Since it's async these now happen out of order sometimes.
Two main things we can do in parallel:
This makes the loader async to make doing this easier.
Deleting the node analysis cache between runs and importing some npm packages (this only makes the first run much faster due to the caches... the second run is the same speed as befroe):
Deleting the TypeScript emit and module analysis cache between runs and importing multiple copies of Dax:
Note that this is still parsing typescript files sequentially because it doesn't include (denoland/deno_graph#477). It is just emitting typescript files in parallel.