Skip to content

Improve flint performance with multivariate polyratfun#838

Open
jodavies wants to merge 2 commits into
form-dev:masterfrom
jodavies:perf-flint
Open

Improve flint performance with multivariate polyratfun#838
jodavies wants to merge 2 commits into
form-dev:masterfrom
jodavies:perf-flint

Conversation

@jodavies
Copy link
Copy Markdown
Collaborator

@jodavies jodavies commented Jun 4, 2026

The first commit improves a few hotspots in the flint interface.

The second uses FORM's symbol ordering for polyratfun operations, instead of sorting the variables by degree, which the poly class does. This means we can avoid sorting flint's result, since it is already sorted correctly. This leads to large improvements in multivariate polyratfun benchmarks. Speedup w.r.t master:

Benchmark 1st commit 2nd commit
ibp-box2l 1.04 ± 0.02 1.09 ± 0.02
ibp-mbox1l 1.04 ± 0.04 1.17 ± 0.04
ibp-pent1l 1.07 ± 0.05 1.32 ± 0.06
ibp-tri3l 1.01 ± 0.02 1.04 ± 0.01

(These are updated ibp benchmarks in the style of "mbox1l", which are not yet merged into form-bench. They have coefficients which are rational polys in 3, 5, 6, 2 variables respectively.).

The caveat is that the signs of the numerator and denominator may change in some cases w.r.t the old behaviour. I would argue that the new behaviour is more consistent, but nonetheless the second commit also adds On OldPRFSign; in case the user really needs output which agrees exactly with the old behaviour.

jodavies added 2 commits June 4, 2026 14:52
These changes are worth ~2% in scripts which make heavy use of polynomial
arithmetic.
This means we can rely on the sorted result from FLINT to be in the required
order, so we can avoid the unnecessary additional sort into FORM order after
computation.

The result is also more consistent, in that the denominator always has a
positive leading coefficient in the final result, which was not the case
previously.

Introduce "On OldPRFSign;" switch to force the old ordering, in case the user
requires this for any reason.
@coveralls
Copy link
Copy Markdown

Coverage Status

coverage: 62.8% (-0.003%) from 62.803% — jodavies:perf-flint into form-dev:master

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants