Merged
Conversation
ibraheemdev
commented
Aug 21, 2025
Contributor
Diagnostic diff on typing conformance testsNo changes detected when running ty on typing conformance tests ✅ |
Contributor
|
2d4f502 to
049b9cc
Compare
049b9cc to
a73cbf9
Compare
Contributor
|
MichaReiser
approved these changes
Aug 22, 2025
Member
MichaReiser
left a comment
There was a problem hiding this comment.
Nice. Can you try to get some numbers from a real world project when using a release build? I'm curious how much this reduces the memory usage for Expression and Definition (of which we have many of)
1eec1e9 to
56dba8e
Compare
56dba8e to
9285d64
Compare
Member
Author
|
Here's the diff from on a release build of Found 29228 diagnostics
=======SALSA STRUCTS=======
-`Definition` metadata=19.83MB fields=39.66MB count=495746
-`Expression` metadata=12.75MB fields=14.87MB count=265605
+`Definition` metadata=19.83MB fields=27.76MB count=495746
+`Expression` metadata=12.75MB fields=6.37MB count=265605
`StringLiteralType` metadata=3.24MB fields=5.88MB count=57943
`IntersectionType` metadata=1.99MB fields=4.60MB count=35545
`File` metadata=1.69MB fields=4.52MB count=26449
@@ -24,12 +24,12 @@
`FileModule` metadata=0.11MB fields=0.29MB count=1992
`GenericAlias` metadata=0.91MB fields=0.26MB count=16249
`ModuleNameIngredient` metadata=0.24MB fields=0.23MB count=4344
-`Unpack` metadata=0.17MB fields=0.20MB count=4223
`ModuleLiteralType` metadata=0.44MB fields=0.17MB count=8470
`TypeVarInstance` metadata=0.12MB fields=0.16MB count=2176
`StarImportPlaceholderPredicate` metadata=0.22MB fields=0.16MB count=7889
`BoundMethodType` metadata=0.36MB fields=0.16MB count=6485
`GenericContext` metadata=0.10MB fields=0.15MB count=1822
+`Unpack` metadata=0.17MB fields=0.14MB count=4223
`BoundTypeVarInstance` metadata=0.25MB fields=0.07MB count=4513
`PatternPredicate` metadata=0.02MB fields=0.07MB count=768
`Project` metadata=0.00MB fields=0.06MB count=1
@@ -51,7 +51,7 @@
`module_type_symbols::interned_arguments` metadata=0.00MB fields=0.00MB count=1
=======SALSA QUERIES=======
`semantic_index -> ty_python_semantic::semantic_index::SemanticIndex`
- metadata=21.75MB fields=409.71MB count=6117
+ metadata=21.75MB fields=407.52MB count=6117
`parsed_module -> ruff_db::parsed::ParsedModule`
metadata=0.47MB fields=284.40MB count=6126
`use_def_map -> alloc::sync::Arc<ty_python_semantic::semantic_index::use_def::UseDefMap>`
@@ -157,8 +157,8 @@
`TypeVarInstance < 'db >::lazy_constraints_ -> core::option::Option<ty_python_semantic::types::TypeVarBoundOrConstraints>`
metadata=0.00MB fields=0.00MB count=3
=======SALSA SUMMARY=======
-TOTAL MEMORY USAGE: 1420.38MB
+TOTAL MEMORY USAGE: 1397.73MB
struct metadata = 71.31MB
- struct fields = 93.10MB
+ struct fields = 72.63MB
memo metadata = 213.48MB
- memo fields = 1042.49MB
+ memo fields = 1040.30MB |
second-ed
pushed a commit
to second-ed/ruff
that referenced
this pull request
Sep 9, 2025
## Summary Removes the `module_ptr` field from `AstNodeRef` in release mode, and change `NodeIndex` to a `NonZeroU32` to reduce the size of `Option<AstNodeRef<_>>` fields. I believe CI runs in debug mode, so this won't show up in the memory report, but this reduces memory by ~2% in release mode.
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
Removes the
module_ptrfield fromAstNodeRefin release mode, and changeNodeIndexto aNonZeroU32to reduce the size ofOption<AstNodeRef<_>>fields.I believe CI runs in debug mode, so this won't show up in the memory report, but this reduces memory by ~2% in release mode.