Repository navigation
Enable PGO for Windows x86-64 ty releases - #4217
Merged
charliermarsh merged 7 commits intoAug 11, 2026
Merged
Conversation
charliermarsh
force-pushed
the
charlie/ty-pgo-windows-x64
branch
from
August 10, 2026 14:12
d09ee52 to
3af07c5
Compare
charliermarsh
force-pushed
the
charlie/ty-pgo-windows-x64
branch
from
August 10, 2026 14:53
3af07c5 to
ebc0bc0
Compare
charliermarsh
force-pushed
the
charlie/ty-pgo-windows-x64
branch
from
August 10, 2026 14:56
ebc0bc0 to
716651a
Compare
charliermarsh
force-pushed
the
charlie/ty-pgo-windows-x64
branch
from
August 10, 2026 20:21
716651a to
5ce5a72
Compare
charliermarsh
force-pushed
the
charlie/ty-pgo-windows-x64
branch
from
August 10, 2026 22:57
5ce5a72 to
042217e
Compare
charliermarsh
marked this pull request as ready for review
August 10, 2026 23:16
MichaReiser
approved these changes
Aug 11, 2026
MichaReiser
left a comment
Member
There was a problem hiding this comment.
It would be great to add a more detailed table of the performance improvement, much like the one you added to the first PR, if you have it.
charliermarsh
force-pushed
the
charlie/ty-pgo-windows-x64
branch
from
August 11, 2026 13:41
042217e to
ad4e69b
Compare
MichaReiser
approved these changes
Aug 11, 2026
MichaReiser
left a comment
Member
There was a problem hiding this comment.
I hope we don't run into any issues with dependencies not being available on windows.
charliermarsh
force-pushed
the
charlie/ty-pgo-windows-x64
branch
3 times, most recently
from
August 11, 2026 17:56
c8700e9 to
12fa870
Compare
charliermarsh
force-pushed
the
charlie/ty-pgo-windows-x64
branch
from
August 11, 2026 19:48
12fa870 to
89f490b
Compare
charliermarsh
force-pushed
the
charlie/ty-pgo-windows-x64
branch
from
August 11, 2026 20:05
89f490b to
98203f8
Compare
charliermarsh
added a commit
that referenced
this pull request
Aug 11, 2026
## Summary This PR enables PGO for ty releases, starting with Linux x86-64. The approach follows that outlined in astral-sh/ruff#27570. ### Design The release pipeline is modified as follows: - We build an instrumented release binary using the Rust toolchain pinned by the Ruff submodule. - We run `ty check` on the same ten pinned ecosystem projects used by Ruff. In total, the corpus contains 618 Python and stub files. - We also exercise `ty server` against a temporary project, covering diagnostics, hover, go-to-definition, completion, and incremental cross-file edits. - We merge the profiles via `llvm-profdata`. - We derive LLVM's hot-code threshold from the profile's 95th percentile, matching its size-optimization threshold and avoiding unnecessary expansion of moderately hot functions. (Without this, performance was marginally better, but wheel size _increased_ by 5-10%!) - We feed the result back into the existing `maturin` build. ### Results Here's the initial, untuned PGO performance on seven held-out projects (and language-server performance on three held-out projects): | Held-out project | `ty check` | Incremental edits | | --- | ---: | ---: | | Black | 7.1% faster | 17.1% faster | | isort | 13.3% faster | 18.1% faster | | Jinja | 5.5% faster | 13.7% faster | | Django | 25.5% faster | — | | pandas | 15.9% faster | — | | scikit-learn | 19.6% faster | — | | SymPy | 21.5% faster | — | | Geometric mean | **15.8% faster** | **16.3% faster** | As an aside, profiling the language server explicitly (i.e., including the language server commands in the PGO training) improved incremental-edit latency by another 7.6% over CLI-only PGO; without that training, incremental edit performance was _still_ up (but not quite as much). Beyond raw performance, with the tuned PGO settings, we see the following results: - **Binary size decreased by 7.98%** (28.10 MB to 25.86 MB compared with non-PGO). - **Wheel size decreased by 1.32%** (12.71 MB to 12.54 MB compared with non-PGO), and by 14.11% compared with untuned PGO. - **Release archive size decreased by 1.53%** (12.35 MB to 12.16 MB compared with non-PGO), and by 14.25% compared with untuned PGO. - **Incremental language-server edits are 3.30% faster than untuned PGO**. - **Linux x86-64 release build finishes in 11m28s on eight-core Depot**, compared with 12m59s on four-core Depot and 15m45s on the previous GitHub runner. The full-stack bottleneck shifts to Windows at 12m24s; other Linux targets retain their four-core runners. ### Stack Additional platforms are covered in subsequent PRs: - macOS ARM64: #4216 - Windows x86-64: #4217 - Linux ARM64: #4218 Ruff and uv follow the same approach; see astral-sh/ruff#27570 and astral-sh/uv#21001.
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
This PR enables PGO for ty's Windows x86-64 releases, following the approach outlined in #4213. Both builds preserve static Visual C++ runtime linking.
On the Windows holdout set,
ty checkuses 19.7% less CPU and finishes 17.5% faster, while incremental language-server edits get 14.7% faster. The release binary gets 9.6% smaller, and the wheel and release archive each get 3.4% smaller.Only the Windows x86-64 PGO job uses the same 16-core Namespace runner as Ruff, reducing the full-stack build from 26m 08s to 12m 24s (53%). The previous 32-core Depot runner took 14m 17s. With Linux x86-64 at 11m 28s and Linux ARM64 at 11m 37s, Windows is now the release bottleneck. The remaining Windows targets keep their existing runners.