-
Notifications
You must be signed in to change notification settings - Fork 126
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Possible performance issue in MPolyAnyMap / ring flattening #4112
Comments
Just a few comments:
Can you provide us with a simple example? I wonder how much one gains by fixing 1. |
This cropped up on Wednesday morning when analyzing some of the big examples in our test suite. I will try to reproduce it and post details. It may have been during one of the testsets of
By the way, a related issue affects the literature models (@HereAround is already looking into this, but is hampered by a broken laptop)
Here polynomials are loaded by parsing them via |
@HechtiDerLachs can you comment how bad this still is? |
We have some timings in #4124. It has improved, that is. |
During the "Julia performance tuning crash course" I did this week's OSCAR workshop, we looked at some of the "big" test suites in our tests, those which use 60GB of RAM and more, and found various sources of RAM usage.
One that was prominent across the board was the
evaluate
function forMPolyAnyMap
, e.g. used for ring flattening.The problem: it seems that images are constructed using
+
and^
. So if you map e.g.x^2*y + 5*y^3
to an isomorphic polynomial ring, then it gradually buildsx^2
,x^2*y
,y^3
,5*y^3
,x^2*y + 5*y^3
i.e. a ton of intermediate objects.Of course in general, this is the best we can do.
But here the codomain is a polynomial ring.
There are multiple ways I can think of to address this, not necessarily mutually exclusive. e.g.
We could perhaps add a special case to
MPolyAnyMap
for when the codomain is an MPolyRing? Ideally it would then use (the equivalent of) anMPolyBuildCtx
.Perhaps we need additional kinds of maps that are optimized for certain setups?
Perhaps the ring flattening code should simply not use
MPolyAnyMap
in the first place, but do its job differently?And perhaps we are not using
MPolyAnyMap
optimally in some cases?... something else?
Here is a very simple way how
R = k[x...]
,S = R[y...]
could be mapped more efficiently toU = k[x...,y...]
: consider a termc * Y
inS
, wherec in R
andY
is a monomialy^e
withe=(e1,...,en)
. To map it, we can iterate over the terms inc
which have the formd * x^f
for somed in k
and exponent vectorf
. For each of these terms, we just need to push(c, vcat(f,e))
into theMPolyBuildCtx
.Of course this only works if we map variables to variable, and if the variables are arranged in just this way. But it is my understanding that this is what we have in ring flattening situations anyway.
The process can also be adjusted to more than two "levels" (i.e.
k[x...][y...][z...]
) if necessary.To go beyond
MPolyRing
yet more thoughts are required, but I am confident we can do something.The text was updated successfully, but these errors were encountered: