Commit d14149d
authored
[ty] Compact retained definition kinds (#25610)
## Summary
Several common `DefinitionKind` variants retain separate references to
child AST nodes even though their parent node already retains those
children. Lambda parameter definitions also retain a `usize` index.
Retain parent nodes for annotated assignments, import-from submodules,
for statements, comprehensions, and with items, recovering their child
nodes through the parent when needed. Store lambda parameter indices as
`u32`.
On oaiproto, this reduces retained memory by 1,175,760 bytes (0.289%).1 parent 7d747eb commit d14149d
3 files changed
Lines changed: 84 additions & 90 deletions
File tree
- crates
- ty_python_core/src
- ty_python_semantic/src/types/infer/builder
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1250 | 1250 | | |
1251 | 1251 | | |
1252 | 1252 | | |
1253 | | - | |
1254 | | - | |
1255 | | - | |
1256 | | - | |
1257 | | - | |
1258 | | - | |
| 1253 | + | |
1259 | 1254 | | |
1260 | 1255 | | |
1261 | 1256 | | |
| |||
1274 | 1269 | | |
1275 | 1270 | | |
1276 | 1271 | | |
1277 | | - | |
| 1272 | + | |
1278 | 1273 | | |
1279 | | - | |
1280 | 1274 | | |
1281 | 1275 | | |
1282 | 1276 | | |
| |||
1295 | 1289 | | |
1296 | 1290 | | |
1297 | 1291 | | |
1298 | | - | |
| 1292 | + | |
1299 | 1293 | | |
1300 | 1294 | | |
1301 | | - | |
1302 | 1295 | | |
1303 | 1296 | | |
1304 | 1297 | | |
| |||
1311 | 1304 | | |
1312 | 1305 | | |
1313 | 1306 | | |
1314 | | - | |
| 1307 | + | |
1315 | 1308 | | |
1316 | 1309 | | |
1317 | 1310 | | |
| |||
2741 | 2734 | | |
2742 | 2735 | | |
2743 | 2736 | | |
2744 | | - | |
| 2737 | + | |
2745 | 2738 | | |
2746 | 2739 | | |
2747 | 2740 | | |
| |||
2764 | 2757 | | |
2765 | 2758 | | |
2766 | 2759 | | |
2767 | | - | |
2768 | | - | |
2769 | | - | |
2770 | | - | |
2771 | | - | |
| 2760 | + | |
2772 | 2761 | | |
2773 | 2762 | | |
2774 | 2763 | | |
| |||
0 commit comments