mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2026-04-25 17:26:22 +03:00
[GH-ISSUE #821] What's happening with performances ? #2387
Labels
No labels
bug
enhancement
enhancement
enhancement
fixed in next
fixed in next
fixed in next
new rule
new rule
new rule
pull-request
question
refactoring
refactoring
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/markdownlint#2387
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @nvuillam on GitHub (May 17, 2023).
Original GitHub issue: https://github.com/DavidAnson/markdownlint/issues/821
Since 0.34, linting 230 files takes more than 200 seconds whereas with 0.33 it was 6 seconds :(
Note: markdownlint is called with the list of files as input parameter, ex:
markdownlint file1.md file2.md path/to/my/file3.mdI'm thinking about downgrading markdownlint in MegaLinter... or maybe there is some fix to perform ? :)
Many thanks for your linter and for your support !
@DavidAnson commented on GitHub (May 17, 2023):
The latest version of markdownlint uses a second parser, micromark, for some of its rules. micromark includes positional information that is missing from the original parser, markdownit-it. Unfortunately, micromark is not as fast - and during this transition time, running two parsers isn't helping. The good news is that rules I migrated to micromark were all improved by doing so. Additionally, I spent time reviewing micromark code and got a PR merged there which will give something like 10 or 15% improvement once released. micromark also rewrote and improved table parsing for a 10% improvement and that will be part of the next markdownlint release. I was well aware of this performance impact and I didn't take the decision lightly, but correctness and accuracy improvements coming from micromark seem worthwhile. I look at performance pretty regularly and if you have suggestions, I am happy to consider them. The short term goal is to finish migrating to micromark, at which point I will be able to stop running markdown-it (unless custom rules need it). That should help improve performance, but I don't think it will return to where it was due to the relative speeds of the two parsers.
@DavidAnson commented on GitHub (May 17, 2023):
Re-reading your comment, the slow down you are seeing seems more dramatic than I would expect. If you are able to share the repository or a set of files to reproduce that level of slow down, I can have a look at whether it's triggering some kind of edge case. Thank you!
@DavidAnson commented on GitHub (May 17, 2023):
One more follow up, if you haven't tried using markdownlint-cli2, it is generally faster than markdownlint-cli, and that may allow you to recover some time.
@nvuillam commented on GitHub (May 17, 2023):
@DavidAnson thanks for your quick reply:)
This is running on own MegaLinter repository using beta version :)
https://github.com/oxsecurity/megalinter/actions/runs/5008752311/jobs/8976954079?pr=2649
This is indeed dramatic, as even if we parallelize and prioritize linter jobs, Github Action servers has only 2 cores, so it locks one of them dring markdownlint process, and increase a lot the total linting time :/
I had a PR about markdownlint-cli2 , but I wasn't convinced of the necessity to replace markdownlint-cli... and if the performance issue is in the core markdownlint, it probably won't change a lot :/
@DavidAnson commented on GitHub (May 18, 2023):
I have good news! Your project's heavy use of tables causes it to run into some really, really bad performance in
micromark's table code. They improved that code in a recent release (which is already used bymarkdownlintin itsnextbranch). If I swap in the better table code,markdownlintperformance is much closer to what it was in the previous version.Below are some quick timings I did in a GitHub Codespace (to approximate the same hardware as Actions). The summary is that
markdownlint-cli0.33.0 takes about 1 second, 0.34.0 takes about 54 seconds, and 0.34.0 with the better table code formicromarktakes about 3 seconds. It's slower as expected, but only by 2 seconds, not 53 seconds. This difference should hopefully be insignificant in your Workflow scenario.@nvuillam commented on GitHub (May 18, 2023):
@DavidAnson thanks for the analysis :)
Do you plan to release a next version soon ?
We are close to releasing a new major MegaLinter version and I really would like markdownlint to be performant again within it :)
@DavidAnson commented on GitHub (May 18, 2023):
I am iterating on the VS Code extension right now and I think there are three open bugs in the markdownlint repo that I would like to fix before doing a release. That's probably not going to be soon enough for you. What about not upgrading the version of markdownlint-cli for this release of MegaLinter?
@nvuillam commented on GitHub (May 18, 2023):
@DavidAnson there was no wrong answer, I'll downgrade for now, and once you'll have released I'll upgrade again to the latest version :)
Thanks a lot for your support :)
@DavidAnson commented on GitHub (May 18, 2023):
Great. Sorry for the trouble!
@DavidAnson commented on GitHub (Jun 1, 2023):
More good news! The two commits I made to
micromarkto improve performance showed up in a recent build which will be part of the nextmarkdownlintrelease in a few days.https://github.com/micromark/micromark/releases/tag/3.2.0
@nvuillam commented on GitHub (Jun 1, 2023):
Good news indeed, I stay tuned :)
@DavidAnson commented on GitHub (Jun 2, 2023):
Fixed in
v0.29.0.