-
-
Notifications
You must be signed in to change notification settings - Fork 33.7k
src: move import.meta initializer to native land #60603
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
base: main
Are you sure you want to change the base?
Conversation
When the source text module is compiled without custom callbacks, instead of calling into JS land from the per-isolate import.meta initializer and then back to C++ land to set up lazy data properties, just do the initialization all in C++ land. Only import.meta.resolve initialization will call back into JS land to generate a closure that call the cascaded loader for resolution. In addition, simplify the loader structure by merging allowImportMetaResolve into isForAsyncLoaderHookWorker - the two are essentially equivalent, as import.meta.resolve is only allowed in a non-loader-hook worker thread's loader.
|
Review requested:
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #60603 +/- ##
==========================================
- Coverage 88.57% 88.53% -0.05%
==========================================
Files 704 703 -1
Lines 208087 208075 -12
Branches 40090 40088 -2
==========================================
- Hits 184306 184212 -94
- Misses 15849 15886 +37
- Partials 7932 7977 +45
🚀 New features to boost your workflow:
|
aduh95
left a comment
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 modulo the lint failure
GeoffreyBooth
left a comment
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 would expect that this should result in performance improvements, especially for a project with a lot of modules; should we run a benchmark?
Instead of measuring the performance of the entire module initialization, focus only on the import.meta initialization.
Yes...and no. If I modify the benchmarks like what I just pushed so that it entirely focuses on import.meta initialization, not the entire module loading, then there's an improvement: For the original version of the benchmark, which measures the entire performance of running Nonetheless it seems useful to have a more focused benchmark, since we already have other benchmarks for measuring the entire loading process. |
|
Pushed the new benchmark. Can I get another review please? @GeoffreyBooth @aduh95 |
When the source text module is compiled without custom callbacks, instead of calling into JS land from the per-isolate import.meta initializer and then back to C++ land to set up lazy data properties, just do the initialization all in C++ land. Only import.meta.resolve initialization will call back into JS land to generate a closure that call the cascaded loader for resolution.
In addition, simplify the loader structure by merging allowImportMetaResolve into isForAsyncLoaderHookWorker - the two are essentially equivalent, as import.meta.resolve is only allowed in a non-loader-hook worker thread's loader.