Cache parsed path mapping patterns#44078
Conversation
|
|
||
| export function tryParsePattern(pattern: string): Pattern | undefined { | ||
| // This should be verified outside of here and a proper error thrown. | ||
| Debug.assert(hasZeroOrOneAsteriskCharacter(pattern)); |
There was a problem hiding this comment.
Why did we remove the assert or requirement that users of this have this checked already?
There was a problem hiding this comment.
The check was duplicated between the caller and the assert (none needed it for other reasons - they were just doing it to satisfy this requirement). I didn't think the requirement made the API conceptually clearer or the implementation simpler - on the contrary, I thought it was preferable to gather all the checks into a single function.
There was a problem hiding this comment.
Perhaps your question was "what happened to the proper error?". It's still there - an undefined result now indicates that an error should be reported.
If a project has many of them (e.g. 1800), parsing the patterns repeatedly can take up a lot of time.
|
Force push is a rebase onto master. Updates to follow. |
|
@typescript-bot pack this |
|
Hey @amcasey, I've packed this into an installable tgz. You can install it for testing by referencing it in your and then running There is also a playground for this build and an npm module you can use via |
If a project has many of them (e.g. 1800), parsing the patterns repeatedly can take up a lot of time.
Specifically,
getOwnKeysandhasZeroOrOneAsteriskCharacterwere showing up as self-time hotspots.