mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-12-17 06:20:12 +01:00
Cache all top-level calls to filterByTypes (~7% runtime reduction).
This commit is contained in:
parent
85e704f32a
commit
dfcb4529f3
47 changed files with 427 additions and 481 deletions
|
|
@ -604,14 +604,13 @@ function lintContent(
|
|||
const parsersNone = Object.freeze({});
|
||||
const paramsBase = {
|
||||
name,
|
||||
"parsers": parsersMarkdownIt,
|
||||
"lines": Object.freeze(lines),
|
||||
"frontMatterLines": Object.freeze(frontMatterLines)
|
||||
};
|
||||
const referenceLinkImageData =
|
||||
helpers.getReferenceLinkImageData(micromarkTokens);
|
||||
cache.set({
|
||||
referenceLinkImageData
|
||||
cache.initialize({
|
||||
...paramsBase,
|
||||
"parsers": parsersMicromark,
|
||||
"config": null
|
||||
});
|
||||
// Function to run for each rule
|
||||
let results = [];
|
||||
|
|
@ -826,7 +825,7 @@ function lintContent(
|
|||
} catch (error) {
|
||||
callbackError(error);
|
||||
} finally {
|
||||
cache.clear();
|
||||
cache.initialize();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue