Commit 2d22247
Reduce gc.collect() frequency in test teardown from every test to every 50
gc.collect() costs ~130-380ms per call scanning all tracked Python objects,
even when it finds zero cyclic garbage. PyTorch tensors are freed by
reference counting, not GC, so per-test collection is unnecessary overhead.
Running it every 50 tests (and at session end) is sufficient to handle any
hypothetical cyclic garbage accumulation while saving ~24% on test runtime.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>1 parent 16eb28e commit 2d22247
1 file changed
+7
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
32 | 35 | | |
33 | 36 | | |
34 | | - | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
35 | 41 | | |
36 | 42 | | |
37 | 43 | | |
| |||
0 commit comments