Skip to content

Benchmark TSP against LSP for a cold start on PyTorch - #5441

Open
kinto0 wants to merge 1 commit into
kinto0/tsp-bench-2-warmfrom
kinto0/tsp-bench-3-cold-start
Open

kinto0 wants to merge 1 commit into
kinto0/tsp-bench-2-warmfrom
kinto0/tsp-bench-3-cold-start

Conversation

@kinto0

@kinto0 kinto0 commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Stack (review and merge in order):

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.

Test Plan:

PYREFLY_LOG=off buck2 run @fbcode//mode/opt fbcode//pyrefly/pyrefly:tsp_bench -- --bench --noplot pytorch_cold_start
group lsp tsp
tsp/pytorch_cold_start 1.46 s 7.87 s
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.

Test Plan:
```
PYREFLY_LOG=off buck2 run @fbcode//mode/opt fbcode//pyrefly/pyrefly:tsp_bench -- --bench --noplot pytorch_cold_start
```
| group | lsp | tsp |
|---|---|---|
| `tsp/pytorch_cold_start` | 1.46 s | 7.87 s |

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

1 participant