I have a project with a local data folder, which is listed in all .*ignore files. When this temp folder gets quite large (more than 10K files), Markdownlint seems to become much slower than other linting tools (Prettier and ESLint). This suggests that the ignore logic could be improved.
Here are the reproduction steps for macOS Catalina and zsh. I only compare Markdownlint with Prettier here for simplicity, but according to my observations, ESLint also remains quite performant.
-
Init a project with README.md , Prettier, Markdownlint and identical .prettierignore + .markdownlintignore files.
mkdir /tmp/slow-markdownlint-repro && cd "$_"
yarn init --yes
yarn add markdownlint-cli prettier
cat <<EOF >README.md
# Hello world
test document
EOF
cat <<EOF >.prettierignore
*.*
!*.md
my-big-temp-folder
node_modules
EOF
cp .prettierignore .markdownlintignore
-
Run Prettier and Markdownlint and observe reasonable performance.
yarn prettier --check "**/*"
## a couple of secs
yarn markdownlint "**/*"
## a couple of secs
-
Create a large folder, which is already listed in the ignore files.
cp -r $(yarn cache dir) my-big-temp-folder
du -sh my-big-temp-folder
## 4.2G in my case 👀
-
Run Prettier and Markdownlint again.
yarn prettier --check "**/*"
## still a couple of secs
yarn markdownlint "**/*"
## 115 secs in my case 👈
-
Delete the project to release disk space.
cd ~
rm -rf /tmp/slow-markdownlint-repro
It feels like Markdownlint CLI still lists all the files in the ignored folder and then matches each path against the ignore list, while Prettier does not even look into my-big-temp-folder.
I don’t know Markdownlint internals well enough to submit a PR, but I hope that my repro steps may help with the investigation 🙌
I believe that having large local data / var / temp folders is not that rare in software development, so I won’t be the only person who would benefit from performance improvements 🙂
I have a project with a local data folder, which is listed in all
.*ignorefiles. When this temp folder gets quite large (more than 10K files), Markdownlint seems to become much slower than other linting tools (Prettier and ESLint). This suggests that the ignore logic could be improved.Here are the reproduction steps for macOS Catalina and zsh. I only compare Markdownlint with Prettier here for simplicity, but according to my observations, ESLint also remains quite performant.
Init a project with
README.md, Prettier, Markdownlint and identical.prettierignore+.markdownlintignorefiles.Run Prettier and Markdownlint and observe reasonable performance.
Create a large folder, which is already listed in the ignore files.
Run Prettier and Markdownlint again.
Delete the project to release disk space.
It feels like Markdownlint CLI still lists all the files in the ignored folder and then matches each path against the ignore list, while Prettier does not even look into
my-big-temp-folder.I don’t know Markdownlint internals well enough to submit a PR, but I hope that my repro steps may help with the investigation 🙌
I believe that having large local data / var / temp folders is not that rare in software development, so I won’t be the only person who would benefit from performance improvements 🙂