-
Notifications
You must be signed in to change notification settings - Fork 7
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
Fast path for CommonJS on Module._compile #139
Comments
Pinging @nodejs/loaders |
In general we've been treating the CommonJS loader as legacy that is frozen and not to be updated, because we don't have the resources to debug any issues that may result from changes there. No one on the current loaders/modules team has worked with the CommonJS loader, as it hasn't had updates (other than parts shared with the ESM loader) in years. The ESM loader is much more ripe for optimizations, if I can encourage you to focus there. |
I don't think we've ever agreed that CommonJS loader is a legacy. It is frozen, but only because of the impact caused by compatibility. Many CLI tools (e.g. eslint, npm and tsc) still choose to bundle their sources as a CommonJS bundle (with parhaps one or more CommonJS entry points) to speed up start up time, so optimizations of the CommonJS loader would benefit the ecosystem through these popular apps that still use CommonJS.
I don't think this is true, looking at the git log of |
|
@arcanis You mean if we move the loading of the content to the If this is true, I think we already broke the support for virtual filesystems by moving the |
Yes, and it had to be fixed. It's fine to use faster primitives, but there should be a way for virtual filesystem to still affect them. Ideally that would be through a blessed API, perhaps similar to the loader hooks, and failing that through discouraged access points. |
In theory, we can move the load of content of a module to C++ when:
Since the
content
goes directly to the C++ without modification:Also, I don't have any idea if worth or is viable but maybe we could use StreamedSource instead of
Source
, in this way, we probably can save some memory and load the script much faster.Let me know what you think, this is something that was in my mind for a while and I just wanna to share it with more people to understand if is possible or not.
The text was updated successfully, but these errors were encountered: