Commit 6c5b13c
authored
Force all deserialized objects to the oldest GC generation (#19681)
This is a hack, but it gives ~30% perf win for `mypy -c 'import torch'`
on a warm run. This should not increase memory consumption too much,
since we shouldn't create any cyclic garbage during deserialization (we
do create some cyclic references, like `TypeInfo` -> `SymbolTable` ->
`Instance` -> `TypeInfo`, but those are genuine long-living objects).1 parent 91487cb commit 6c5b13c
1 file changed
Lines changed: 25 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
116 | 116 | | |
117 | 117 | | |
118 | 118 | | |
| 119 | + | |
| 120 | + | |
119 | 121 | | |
120 | 122 | | |
121 | 123 | | |
| |||
707 | 709 | | |
708 | 710 | | |
709 | 711 | | |
| 712 | + | |
| 713 | + | |
710 | 714 | | |
711 | 715 | | |
712 | 716 | | |
| |||
3326 | 3330 | | |
3327 | 3331 | | |
3328 | 3332 | | |
| 3333 | + | |
| 3334 | + | |
| 3335 | + | |
| 3336 | + | |
| 3337 | + | |
| 3338 | + | |
| 3339 | + | |
| 3340 | + | |
| 3341 | + | |
| 3342 | + | |
| 3343 | + | |
| 3344 | + | |
| 3345 | + | |
3329 | 3346 | | |
3330 | 3347 | | |
| 3348 | + | |
| 3349 | + | |
| 3350 | + | |
| 3351 | + | |
| 3352 | + | |
| 3353 | + | |
| 3354 | + | |
| 3355 | + | |
3331 | 3356 | | |
3332 | 3357 | | |
3333 | 3358 | | |
| |||
0 commit comments