mirror of
https://github.com/denoland/deno.git
synced 2024-11-21 15:04:11 -05:00
perf(lsp): add performance marks for TSC requests (#21383)
This should help us get a better picture where most of the time is spent (the TSC or the surrounding Rust code).
This commit is contained in:
parent
ae327d0a83
commit
6718be87c8
2 changed files with 15 additions and 3 deletions
|
@ -208,6 +208,7 @@ fn normalize_diagnostic(
|
|||
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct TsServer {
|
||||
performance: Arc<Performance>,
|
||||
sender: mpsc::UnboundedSender<Request>,
|
||||
specifier_map: Arc<TscSpecifierMap>,
|
||||
}
|
||||
|
@ -217,8 +218,9 @@ impl TsServer {
|
|||
let specifier_map = Arc::new(TscSpecifierMap::new());
|
||||
let specifier_map_ = specifier_map.clone();
|
||||
let (tx, mut rx) = mpsc::unbounded_channel::<Request>();
|
||||
let perf = performance.clone();
|
||||
let _join_handle = thread::spawn(move || {
|
||||
let mut ts_runtime = js_runtime(performance, cache, specifier_map_);
|
||||
let mut ts_runtime = js_runtime(perf, cache, specifier_map_);
|
||||
|
||||
let runtime = create_basic_runtime();
|
||||
runtime.block_on(async {
|
||||
|
@ -238,6 +240,7 @@ impl TsServer {
|
|||
});
|
||||
|
||||
Self {
|
||||
performance,
|
||||
sender: tx,
|
||||
specifier_map,
|
||||
}
|
||||
|
@ -946,9 +949,14 @@ impl TsServer {
|
|||
where
|
||||
R: de::DeserializeOwned,
|
||||
{
|
||||
self
|
||||
let mark = self
|
||||
.performance
|
||||
.mark(format!("tsc {}", req.method), None::<()>);
|
||||
let r = self
|
||||
.request_with_cancellation(snapshot, req, Default::default())
|
||||
.await
|
||||
.await;
|
||||
self.performance.measure(mark);
|
||||
r
|
||||
}
|
||||
|
||||
async fn request_with_cancellation<R>(
|
||||
|
|
|
@ -8309,6 +8309,10 @@ fn lsp_performance() {
|
|||
"op_load",
|
||||
"request",
|
||||
"testing_update",
|
||||
"tsc $configure",
|
||||
"tsc $getAssets",
|
||||
"tsc $getSupportedCodeFixes",
|
||||
"tsc getQuickInfoAtPosition",
|
||||
"update_cache",
|
||||
"update_diagnostics_deps",
|
||||
"update_diagnostics_lint",
|
||||
|
|
Loading…
Reference in a new issue