You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm currently profiling various linting setups of the project's I have access to and noticed that a noticeable chunk is spent on trying to resolve config files for prettier. Prettier in turn uses cosmiconfig to find the config file. Searching for the config files gets seemingly slower the more folders a project has. In my case it consumes about 5% (~9s) of the total linting time for searching for config files. This is a project with a lot of folders.
I went ahead and logged patched cosmiconfig locally to log out every file it tries to read to count them. It looks like it's trying every directory for config files and ultimately this ends up in 14k file system calls during the linting task. The thing is that the project only has one config for prettier and that is located at the project root. No further prettier configurations exist. Therefore those 14k file system calls could be avoided and are in vain.
The text was updated successfully, but these errors were encountered:
The normal behavior should be that if you run the prettier CLI from the project root folder (which should always be the case if you run it via npx or package scripts), it shouldn't look in more places than a few different file names in that folder.
Can you paste that list somewhere (probably external)? Redact parts of the folder names if you want, but try not to remove complete lines or make them completely unreadable.
Also, can you give me the following things:
The exact node version you're using to run prettier
The exact version of prettier you're running
Your OS with version (if Windows, maybe even the exact build shown by winver)
I'm currently profiling various linting setups of the project's I have access to and noticed that a noticeable chunk is spent on trying to resolve config files for prettier. Prettier in turn uses cosmiconfig to find the config file. Searching for the config files gets seemingly slower the more folders a project has. In my case it consumes about 5% (~9s) of the total linting time for searching for config files. This is a project with a lot of folders.
I went ahead and logged patched cosmiconfig locally to log out every file it tries to read to count them. It looks like it's trying every directory for config files and ultimately this ends up in 14k file system calls during the linting task. The thing is that the project only has one config for prettier and that is located at the project root. No further prettier configurations exist. Therefore those 14k file system calls could be avoided and are in vain.
The text was updated successfully, but these errors were encountered: