add logger and performance measurement #138
Draft
+149
−79
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:
LogOutputChannel
namedPretty TypeScript Errors
measure
method for the logger to measure the execution time of certain code pathsuriStore
toMap
instead of aRecord
.changes.filter.forEach(() => items.push())
to a singlereduce
to avoid the double iterationcache
anduriStore
when the extension is deactivated to clean up resources.100
to1000
Notes:
trace
log level, VSCode has to be told to set its log level totrace
to collect all logs. Since most of these measurements are < 1ms they are very unlikely to be the cause of our performance issues.onDidChangeDiagnostics
fires a lot, most of the time with0
uri'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.onDidChangeDiagnostics
with theuri
of 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 calldispose
on 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_MAX
andsupportedDiagnosticSources
. This could be useful to recommend to users, and see if that fixes their performance issues.Some screenshots:
