#11900: Serious regression caused by #9138
---------------------------+------------------------------------------------
   Reporter:  SimonKing    |          Owner:  tbd                  
       Type:  defect       |         Status:  needs_work           
   Priority:  blocker      |      Milestone:  sage-4.7.2           
  Component:  performance  |       Keywords:  categories regression
Work_issues:               |       Upstream:  N/A                  
   Reviewer:               |         Author:  Simon King           
     Merged:               |   Dependencies:  #9138                
---------------------------+------------------------------------------------
Changes (by SimonKing):

 * cc: malb (added)


Comment:

 I managed to implement the new coercion model for libsingular rings,
 therefore cc to Martin.

 One trick to make that work: One should acknowledge that polynomial rings
 are unique parents (unless one destroys uniqueness on purpose), thus, the
 hash can be `id(self)` and `__cmp__` can be identity of objects.

 What has hash and cmp to do with the new coercion model? There was a
 custom `__richcmp__` in the code. It somehow managed to trigger a test for
 the old coercion model. And unfortunately, if replaces `__cmp__` by
 `_element_constructor_` then the test for the ''old'' coercion model
 raises an exception, even though `_element_constructor_` is supposed to be
 a tool of the ''new'' model.

 I think that in a different ticket, one can build on top of that and
 replace the current (and always repeated!) coercion tests on elements by
 tests that are done ''once'' for the parent of these elements. That would
 improve the performance.

 Perhaps that was not a very clear explanation. Anyway.

 With the new coercion, it becomes possible to avoid the construction of a
 coercion from the base ring during initialisation.

 In addition, I am working on a simplification of the choice of category
 during `PolynomialRing_generic.__init__`. It uses
 `sage.rings.categories.Category.join`, but could actually directly
 construct a `JoinCategory`, since all the additional work in
 `sage.rings.categories.Category.join` is not needed. Since `join()` eats a
 lot of time in the benchmarks, I am confident that we will see an
 improvement.

 That's the plan, now I have to do tests...

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/11900#comment:26>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

-- 
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sage-trac?hl=en.

Reply via email to