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
refactor: Cache moo lexer instances #9697
refactor: Cache moo lexer instances #9697
Conversation
As far as parsing code is synchronous, there should not be problems |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, as node functions can't be called in parallel (no multithreading in node yet).
The only think happens is the call order depends on async handling, so we need to be sure lexer state is not shared between async functions.
Also some small suggestions.
lib/manager/bazel/extract.ts
Outdated
lexer.reset(); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lexer.reset(); |
I think this is not needed. 🤔
lib/manager/cake/index.ts
Outdated
@@ -67,5 +66,6 @@ export function extractPackageFile(content: string): PackageFile { | |||
} | |||
token = lexer.next(); | |||
} | |||
lexer.reset(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lexer.reset(); |
lib/manager/gradle-lite/tokenizer.ts
Outdated
({ type, offset, value }) => ({ type, offset, value } as Token) | ||
); | ||
lexer.reset(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lexer.reset(); |
🎉 This PR is included in version 25.3.0 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
Changes:
Don't create new object each time we need to parse something.
Context:
Documentation (please check one with an [x])
How I've tested my work (please tick one)
I have verified these changes via: