Skip to content

Reuse basis product keys in the Newton postfilter - #485

Open
blegat wants to merge 1 commit into
mainfrom
bl/buffered-newton-postfilter
Open

blegat wants to merge 1 commit into
mainfrom
bl/buffered-newton-postfilter

Conversation

@blegat

@blegat blegat commented Nov 27, 2026 •

Copy link
Copy Markdown
Member

Use MutableArithmetics scratch storage for single-term Gram products during both initialization and pruning. Retain an owned exponent key only when inserting a new sign count, and reuse that key for back edges.

Postfilter benchmark on Julia 1.13.4, median of 11 warm calls against cdd60a7. All cases returned identical Gram bases. The pruning case for both monomial bases reduced 105 candidates to 15.

Basis Case Before allocations After allocations Before MiB After MiB
Monomial Weighted 4,754 986 0.207 0.063
Monomial Pruning 45,713 2,679 1.838 0.196
Scaled monomial Weighted 4,754 986 0.207 0.063
Scaled monomial Pruning 45,713 2,679 1.838 0.196
Chebyshev Weighted 17,435 17,435 0.666 0.666
Chebyshev Pruning 35,726 35,726 1.332 1.332
Basis Weighted case Pruning 105 candidates to 15
Monomial 0.106 → 0.090 ms (15% less) 0.993 → 0.832 ms (16% less)
Scaled monomial 0.180 → 0.163 ms (9% less) 1.836 → 1.660 ms (10% less)

The benchmark uses the local upstream stack at StarAlgebras ed489f2, MultivariatePolynomials e43390d, and MultivariateBases c68c2cc.

Use MutableArithmetics scratch storage for single-term Gram products
during both initialization and pruning. Retain an owned exponent key
only when inserting a new sign count, and reuse that key for back edges.

Postfilter benchmark on Julia 1.13.4, median of 11 warm calls against
cdd60a7. All cases returned identical Gram bases. The pruning case for
both monomial bases reduced 105 candidates to 15.

| Basis | Case | Before allocations | After allocations | Before MiB | After MiB |
| --- | --- | ---: | ---: | ---: | ---: |
| Monomial | Weighted | 4,754 | 986 | 0.207 | 0.063 |
| Monomial | Pruning | 45,713 | 2,679 | 1.838 | 0.196 |
| Scaled monomial | Weighted | 4,754 | 986 | 0.207 | 0.063 |
| Scaled monomial | Pruning | 45,713 | 2,679 | 1.838 | 0.196 |
| Chebyshev | Weighted | 17,435 | 17,435 | 0.666 | 0.666 |
| Chebyshev | Pruning | 35,726 | 35,726 | 1.332 | 1.332 |

The benchmark uses the local upstream stack at StarAlgebras ed489f2,
MultivariatePolynomials e43390d, and MultivariateBases c68c2cc.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant