Commit a4d1931
Speed up test_weakref_leak and test_step_args
Profiling-backed changes targeting the two tests where iteration
reduction yields meaningful savings.
test_weakref_leak (89s on CI → estimated ~30s):
Object count profiling shows memory state stabilizes at iteration 2.
The original test used 16 warmup iterations before checking — reduced
to 3 warmup + 3 check = 6 total iterations (from 20). Each
conditional_logp call costs ~4.5s on CI, so removing 14 iterations
saves ~63s.
test_step_args (62s on CI → estimated ~25s):
This test verifies target_accept argument plumbing, checking
acceptance_rate.mean() ≈ 0.5 with decimal=1 precision. The default
pm.sample() uses 1000 draws/tune, but 200 is sufficient for this
loose tolerance. Verified stable over 10 runs with different seeds.
Changes NOT made (profiling showed negligible impact):
- test_default_value_transform_logprob range(10)→range(3): compile
time is 99.98% of cost, loop saves 0.6ms total
- test_interpolated x_points 100k→20k: compilation is 91.8% of cost,
array reduction saves ~296ms across 56 iterations
Addresses #76861 parent a65e8b6 commit a4d1931
2 files changed
Lines changed: 14 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
634 | 634 | | |
635 | 635 | | |
636 | 636 | | |
637 | | - | |
| 637 | + | |
638 | 638 | | |
639 | 639 | | |
640 | | - | |
641 | | - | |
| 640 | + | |
642 | 641 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
691 | 691 | | |
692 | 692 | | |
693 | 693 | | |
694 | | - | |
695 | | - | |
696 | | - | |
697 | | - | |
| 694 | + | |
| 695 | + | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
698 | 700 | | |
699 | 701 | | |
700 | 702 | | |
| |||
709 | 711 | | |
710 | 712 | | |
711 | 713 | | |
712 | | - | |
| 714 | + | |
713 | 715 | | |
714 | 716 | | |
715 | 717 | | |
716 | 718 | | |
717 | 719 | | |
718 | | - | |
| 720 | + | |
| 721 | + | |
| 722 | + | |
| 723 | + | |
| 724 | + | |
719 | 725 | | |
720 | 726 | | |
721 | 727 | | |
| |||
0 commit comments