Repository navigation
Conversation
Stack context: TSP vs pyrefly LSP latency benchmarks on PyTorch. - What: add `benches/tsp/pytorch.rs` to `tsp_bench`. Each sample edits `torch/_inductor/ir.py` and serves one feature through the language server (`lsp`) and through the type server (`tsp`), which replays the recorded Pylance requests for the same feature from `benches/tsp/traces/`: - `tsp/pytorch_hover`: hover on `guard_or_false`. Pylance: 33 requests (`getSnapshot`, one `resolveImport` per import, `getComputedType`). - `tsp/pytorch_completion`: completion after `V.graph.sizevars.`. Pylance: 79 requests. - `tsp/pytorch_recheck`: the diagnostics of the file. LSP: `textDocument/diagnostic`. Pylance: the ~16.5k `getComputedType` requests that its background checker sends after every edit. - Why: a TSP client turns one IDE action into many TSP requests, so TSP latency can regress without any LSP benchmark moving. - Both servers run in process, driven by the shared `pyrefly_lsp_test` client, with the same pinned-checkout resource as `pytorch_bench`. The replay fills in the current snapshot and retries on `snapshot outdated`, as Pylance does. Each request stream is measured alone, although in Pylance the background checker shares the server's queue with hover and completion. Test Plan: ``` PYREFLY_LOG=off buck2 run @fbcode//mode/opt fbcode//pyrefly/pyrefly:tsp_bench -- --bench --noplot pytorch_ ``` | group | lsp | tsp | |---|---|---| | `tsp/pytorch_hover` | 331 ms | 325 ms | | `tsp/pytorch_completion` | 329 ms | 332 ms | | `tsp/pytorch_recheck` | 334 ms | 1.04 s |
This was referenced Oct 29, 2026
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Stack (review and merge in order):
Stack context: TSP vs pyrefly LSP latency benchmarks on PyTorch.
benches/tsp/pytorch.rstotsp_bench. Each sample editstorch/_inductor/ir.pyand serves one feature through the language server (lsp) and through the type server (tsp), which replays the recorded Pylance requests for the same feature frombenches/tsp/traces/:tsp/pytorch_hover: hover onguard_or_false. Pylance: 33 requests (getSnapshot, oneresolveImportper import,getComputedType).tsp/pytorch_completion: completion afterV.graph.sizevars.. Pylance: 79 requests.tsp/pytorch_recheck: the diagnostics of the file. LSP:textDocument/diagnostic. Pylance: the ~16.5kgetComputedTyperequests that its background checker sends after every edit.pyrefly_lsp_testclient, with the same pinned-checkout resource aspytorch_bench. The replay fills in the current snapshot and retries onsnapshot outdated, as Pylance does. Each request stream is measured alone, although in Pylance the background checker shares the server's queue with hover and completion.Test Plan:
tsp/pytorch_hovertsp/pytorch_completiontsp/pytorch_recheck