add logger and performance measurement #138
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I have had this idea for a long time, finally got around to implementing it.
This implements:
LogOutputChannelnamedPretty TypeScript Errorsmeasuremethod for the logger to measure the execution time of certain code pathsuriStoretoMapinstead of aRecord.changes.filter.forEach(() => items.push())to a singlereduceto avoid the double iterationcacheanduriStorewhen the extension is deactivated to clean up resources.100to1000Notes:
tracelog level, VSCode has to be told to set its log level totraceto collect all logs. Since most of these measurements are < 1ms they are very unlikely to be the cause of our performance issues.onDidChangeDiagnosticsfires a lot, most of the time with0uri's. No idea why vscode triggers the event so often, when nothing actually changed. The execution time is < 1ms so its not the cause of the issue.onDidChangeDiagnosticswith theuriof the focussed file very often. Even if there are no difference in diagnostics. This could be on the side of the TS language server where they alter the diagnostics collection, even if the collection stays identical. The execution time is < 1ms so this is also not the cause of the issue.We may have to also calldisposeon the logger, but since we want to preserve the logs in case of a crash or when the extension hangs, I'm not sure if that will also wipe the log.CACHE_SIZE_MAXandsupportedDiagnosticSources. This could be useful to recommend to users, and see if that fixes their performance issues.Some screenshots:
