perf(lsp): instrument all ops with performance marks (#21536)

Adds performance measurements for all ops used by the LSP. Also changes
output of "Language server status" page to include more precise
information.

Current suspicion is that computing "script version" takes a long time
for some users.
This commit is contained in:
Bartek Iwańczuk 2023-12-11 17:33:56 +01:00 committed by GitHub
parent 98121de5be
commit 88566cee72
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 46 additions and 17 deletions

View file

@ -3809,15 +3809,11 @@ impl Inner {
.unwrap();
contents
.push_str("\n## Performance\n\n|Name|Duration|Count|\n|---|---|---|\n");
let mut averages = self.performance.averages();
averages.sort();
for average in averages {
writeln!(
contents,
"|{}|{}ms|{}|",
average.name, average.average_duration, average.count
)
.unwrap();
let mut averages = self.performance.averages_as_f64();
averages.sort_by(|a, b| a.0.cmp(&b.0));
for (name, count, average_duration) in averages {
writeln!(contents, "|{}|{}ms|{}|", name, average_duration, count)
.unwrap();
}
Some(contents)
} else {