Repository navigation
[ty] Inline short AST string literals - #27601
Closed
charliermarsh wants to merge 1 commit into
Closed
charliermarsh wants to merge 1 commit into
charliermarsh wants to merge 1 commit into
Conversation
charliermarsh
requested review from
a team,
MichaReiser and
dhruvmanila
as code owners
August 8, 2026 17:47
Memory usage reportSummary
Significant changesClick to expand detailed breakdownflake8
trio
sphinx
prefect
|
|
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
Store regular string literals and interpolated-string literal segments in
CompactStringinstead ofBox<str>, avoiding separate heap allocations for short values.Update parser construction, Ruff rule autofixes, formatter normalization, AST comparison, and ty IDE references to use the new representation. Formatter normalization can now append directly to an existing literal instead of converting through an intermediate
String.CompactStringincreasesExprFStringfrom 56 to 64 bytes on 64-bit targets; the enclosingExprremains 72 bytes onmain. This isolates the allocation-versus-layout tradeoff from the separate expression-size reduction in #27591.