#14592: Use lazy strings for error messages in coercion
-----------------------------------------------+----------------------------
       Reporter:  SimonKing                    |         Owner:  tbd      
           Type:  enhancement                  |        Status:  new      
       Priority:  major                        |     Milestone:  sage-5.10
      Component:  performance                  |    Resolution:           
       Keywords:  lazy error message coercion  |   Work issues:           
Report Upstream:  N/A                          |     Reviewers:           
        Authors:                               |     Merged in:           
   Dependencies:  #14585                       |      Stopgaps:           
-----------------------------------------------+----------------------------

Comment (by SimonKing):

 I don't know of striking benchmarks yet. But it could be that the
 following taken from #11900 may be useful:
 {{{
 sage: %time M = Matrix(W, 2, 3, [10^30*(1-z)^13, 1, 2, 3, 4,
 z]).echelon_form()
 }}}
 {{{
 sage: W.<z> = CyclotomicField(13)
 sage: %time M = Matrix(W, 2, 3, [10^30*(1-z)^13, 1, 2, 3, 4,
 z]).echelon_form()
 }}}
 {{{
 sage: %time L = EllipticCurve('960d1').prove_BSD()
 }}}
 and
 {{{
 sage: def test(E):
 ....:     for p in prime_range(10000):
 ....:         if p != 389:
 ....:             G = E.change_ring(GF(p)).abelian_group()
 ....:
 sage: E = EllipticCurve('389a')
 sage: %time test(E)
 }}}

 In all these examples,
 {{{
         raise TypeError, "no common canonical parent for objects with
 parents: '%s' and '%s'"%(xp, yp)
 }}}
 at the end of the cpdef method
 `sage.structure.coerce.CoercionModel_cache_maps.canonical_coercion` is
 called a couple of hundred times. I don't know how noticeable a speed-up
 would be, though.

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/14592#comment:1>
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 unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to