Repository navigation
Conversation
Summary: Stack context: TSP vs pyrefly LSP latency benchmarks on PyTorch. - What: add `benches/tsp/record/`, which runs the latest VS Code and Pylance headless with pyrefly as the type server, opens `torch/_inductor/ir.py` in the pinned PyTorch checkout, and drives a hover, a completion, and an idle re-check after edits. It writes every TSP request Pylance sent to `benches/tsp/traces/`, one file per feature (`cold_start`, `hover`, `completion`, `recheck`; ~1 MB in total, checked in), so that each benchmark loads only its own trace and a re-recording diffs per feature. - Why: TSP benchmarks need the requests a real client sends. Hand-written sequences guess wrong: Pylance sends no requests for a repeated hover (it caches types until the snapshot changes), never sends `getDeclaredType`, and re-checks the whole file over TSP after every edit and on open. - Foreground requests come from pyrefly's stdin. Background-checker requests go over an extra connection, so they come from Pylance's own TSP log, which the runner copies as it grows because VS Code rotates it every 5 MB. Differential Revision: D128200913
Summary: 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. Differential Revision: D128185161
Summary: Stack context: TSP vs pyrefly LSP latency benchmarks on PyTorch. - What: add `tsp/pytorch_cold_start` to `benches/tsp/pytorch.rs`. Each sample starts a fresh server, initializes it, and opens `torch/_inductor/ir.py`. LSP: then `textDocument/diagnostic`. TSP: then a replay of the 17,494 requests that Pylance sent after opening the file until it went quiet, mostly its background checker's sweep of the file plus ~1.1k `resolveImport`. - Why: opening a slow file is where TSP costs the most. The sweep on open touches the same ~90 dependency modules as a re-check, but none of them are solved yet. Differential Revision: D128200923
Contributor
|
@kinto0 has exported this pull request. If you are a Meta employee, you can view the originating Diff in D128200923. |
Contributor
Author
kinto0
added a commit
to kinto0/pyrefly
that referenced
this pull request
Oct 30, 2026
Summary: Stack context: TSP vs pyrefly LSP latency benchmarks on PyTorch. - What: add `tsp/pytorch_cold_start` to `benches/tsp/pytorch.rs`. Each sample starts a fresh server, initializes it, and opens `torch/_inductor/ir.py`. LSP: then `textDocument/diagnostic`. TSP: then a replay of the 17,494 requests that Pylance sent after opening the file until it went quiet, mostly its background checker's sweep of the file plus ~1.1k `resolveImport`. - Why: opening a slow file is where TSP costs the most. The sweep on open touches the same ~90 dependency modules as a re-check, but none of them are solved yet. Differential Revision: D128200923
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.
Summary:
Stack context: TSP vs pyrefly LSP latency benchmarks on PyTorch.
tsp/pytorch_cold_starttobenches/tsp/pytorch.rs. Each sample starts a fresh server, initializes it, and openstorch/_inductor/ir.py. LSP: thentextDocument/diagnostic. TSP: then a replay of the 17,494 requests that Pylance sent after opening the file until it went quiet, mostly its background checker's sweep of the file plus ~1.1kresolveImport.Differential Revision: D128200923