-
-
Notifications
You must be signed in to change notification settings - Fork 491
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
Serious regression caused by #9138 #11900
Comments
comment:2
It seems that some time is spent for creating a homset, when creating a matrix space. In fact, during initialisation, a special map from the basering is created for coercion. That has been introduced in #9138 because otherwise coercion from the base ring to the matrix space is too slow. However, it might be better to not create the coerce map during initialisation. After all, it is a waste of time to create it when eventually it is not used. Perhaps that is what is happening here? |
comment:3
When avoiding initialisation of coercion from the base ring into a matrix space,(in addition to caching hom_category and join), I get
|
comment:4
The next problematic call seems to be |
comment:5
Next finding: It could be that the cache for matrix spaces is broken. I inserted a print statement into the initialisation of By the cache implemented in the |
comment:6
Replying to @simon-king-jena:
No, it is differently: The cache uses weak references. In fact, garbage collection is to blame for the double construction of matrix spaces. |
comment:7
When I use strong references for caching matrix spaces (in addition to the previous changes), I get
Of course, one wouldn't like to have all the matrix spaces hanging around. But perhaps it is an option to temporarily turn garbage collection off. However, the computation of |
comment:8
Another time seems to be uselessly spent on a generic method of free module elements: list(). Such a small method ought to be as fast as possible and should thus be overridden in sub-classes. But |
comment:9
Replying to @simon-king-jena:
Neither do |
comment:10
If the initialisation of matrix spaces is changed such that
As a consequence, the |
comment:11
The next surprise is that (even if one avoids category initialisation of matrix spaces) many covariant constructions (quotients and subquotients) are called - that is another reason why Part of the problem may be that But first I need to find out where the quotients and subquotients actually arise. |
comment:12
Yes!! When I use a cache for
and at least this instance of a regression has gone! I don't know how much of it is due to the fact that I also have #11115 applied, but let me first finish the patch and then we'll see. |
comment:13
I have attached a preliminary patch, if someone already wants to have a look. I need to do more tests (and run doctests), but up to now it seems that it fixes the regression. Changes for Matrix Spaces Matrix spaces will not make use of the category framework by default. But I introduced a new method that makes them use the category framework after initialisation:
Minor change: I made Changes for categories I turn I also cache the class method Vectors I added custom
The difference is small, but one should benefit from it. Doc formatting I corrected some wrong formatting in the documentation of dense integral and rational vectors. |
Dependencies: #9138 |
Author: Simon King |
comment:14
The crucial question: Does it fix the speed regression? Here are Jeroen's examples from sage-devel. sage-4.7.2.alpha2
sage-4.7.2.alpha2 plus #9138 and its dependency
sage-4.7.2.alpha2 plus #9138 and its dependency plus the patch from here
Conclusion #9138 is indeed responsible for all but one regression. The only exception is the test suite for The patch from here fixes most regressions. Problematic remain the |
comment:15
The patch is updated. I did not run the doc tests yet, and also I think one should try to fix the remaining regression, but I turn it into "needs review". |
comment:16
Doing some timing... I am afraid I will not be able to review your patch because I am too unfamiliar with the matter that the patch deals with. Note that your patch applies with "fuzz 2" against a vanilla sage-4.7.2.alpha3, you probably should make a clean version. |
comment:17
With sage-4.7.2.alpha2 plus #9138 plus #11734 (which is a blocker for 4.7.2 merged in alpha3) and the latest patch, I get
|
comment:18
Replying to @jdemeyer:
Really? Did you test the latest patch? Anyway. For me, the priority is to first get it working. |
comment:19
Replying to @simon-king-jena:
I think so.
I agree, but I thougt you should know... |
comment:20
Indeed, there is some fuzz. I'll take care of that in the next patch version. |
comment:21
So far, I did not cache join (only hom_category). That should be done next. |
comment:248
Hi Jeroen, Is it really a problem to have Aha, is it because some people do not have gcc but install a Sage-binary? |
comment:249
Replying to @simon-king-jena:
Standard (non-optional) tests are allowed to depend on gcc. I don't know if this is written in stone anywhere, but there have been many such standard tests in the past. They aren't a problem for buildbots, since they always have GCC installed. If nothing else, it is very important to test that calling the compiler from Sage does work. |
comment:250
Replying to @williamstein:
Really? I thought the opposite is true. I know there are some doctests marked
For example in |
Merged: sage-5.0.beta0 |
comment:252
thank you very much Simon for your work on this ticket (and on #715). Only a few people Paul Zimmermann |
comment:253
Small question: is there are particular reason for writing
instead of
The latter is faster because it bypasses the lookup of the |
comment:254
Replying to @jdemeyer:
When I wrote that line, I was ignorant of the difference in performance. Actually I even thought that Meanwhile I know better and wouldn't write it again in that way. Once again: I HATE THE TRAC WEB INTERFACE!!! While I write these lines, every few seconds the browser window becomes blank and (when I start scrolling and continue writing) reappears in a totally different place. It is a VERY SERIOUS pain in the neck! |
At sage-devel, Jeroen reported a massive regression in elliptic curve computations. The regression was introduced in the transition from sage-4.7.2.alpha2 to sage-4.7.2.alpha3.
It seems that #9138 is responsible, at least for a big part of the regression. With unpatched sage-4.7.2.alpha2, we find
Adding #9138 and its dependency, we obtain
It turns out that much time is wasted for calls to
sage.categories.Category.join
and tosage.categories.Category.hom_category
.When caching these two methods, one can reduce the speed difference to something like that (sage-4.7.2.alpha3 plus #11115 plus an experimental patch for the caching):
However, that's still far from good. After caching join and hom_category, there is still too much time spent (according to %prun) for the initialisation of matrix spaces.
Apply
Depends on #11319
Depends on #9138
Depends on #11911
Depends on #9562
CC: @jdemeyer @nthiery @malb
Component: performance
Keywords: categories regression
Author: Simon King
Reviewer: Jeroen Demeyer, Nicolas M. Thiéry, Simon King, Jason Grout
Merged: sage-5.0.beta0
Issue created by migration from https://trac.sagemath.org/ticket/11900
The text was updated successfully, but these errors were encountered: