Skip to content
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

fs: use getLazy for lazy loading #57307

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Conversation

gurgunday
Copy link
Contributor

@gurgunday gurgunday commented Mar 4, 2025

I think we can centralize the usage of lazy loading with the getLazy util in the codebase

Also before, we lazy loaded multiple modules even when we needed only one, so I believe splitting them further should be a little faster

It's cleaner and more consistent to use this everywhere

@nodejs-github-bot nodejs-github-bot added fs Issues and PRs related to the fs subsystem / file system. needs-ci PRs that need a full CI run. util Issues and PRs related to the built-in util module. labels Mar 4, 2025
Copy link

codecov bot commented Mar 4, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 90.24%. Comparing base (1347d42) to head (f5c15c3).
Report is 4 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #57307   +/-   ##
=======================================
  Coverage   90.24%   90.24%           
=======================================
  Files         630      630           
  Lines      184920   184928    +8     
  Branches    36188    36181    -7     
=======================================
+ Hits       166876   166889   +13     
+ Misses      11064    11063    -1     
+ Partials     6980     6976    -4     
Files with missing lines Coverage Δ
lib/fs.js 98.28% <100.00%> (+<0.01%) ⬆️
lib/internal/util.js 95.80% <100.00%> (ø)

... and 37 files with indirect coverage changes

@joyeecheung
Copy link
Member

I think lazy loading is only beneficial for APIs not commonly used by applications. Most of the APIs being changed here are very commonly used throughout the ecosystem and loading them eagerly keeps them in the snapshot, and would actually speed up loading of applications overall.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fs Issues and PRs related to the fs subsystem / file system. needs-ci PRs that need a full CI run. util Issues and PRs related to the built-in util module.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants