#12265: massively optimize f.change_ring(QQ) for f in ZZ['x']
---------------------------+------------------------------------------------
   Reporter:  was          |          Owner:  tbd         
       Type:  enhancement  |         Status:  needs_review
   Priority:  major        |      Milestone:  sage-5.0    
  Component:  performance  |       Keywords:              
Work_issues:               |       Upstream:  N/A         
   Reviewer:               |         Author:              
     Merged:               |   Dependencies:              
---------------------------+------------------------------------------------
Changes (by was):

  * status:  new => needs_review


Old description:

> I needed to massively optimize f.change_ring(QQ) for f in ZZ['x'] so that
> #11375 would not suck.
>
> For me,
> {{{
> BEFORE:
> sage: R.<x> = ZZ[]; v = [1..10^6]; f = R(v);
> sage: time g = f.change_ring(QQ)
> Time: CPU 4.39 s, Wall: 4.39 s
> sage: R.<x> = ZZ[]; v = [1..10^3]; f = R(v);
> sage: timeit('g = f.change_ring(QQ)')
> 125 loops, best of 3: 1.79 ms per loop
>
> AFTER:
> sage: R.<x> = ZZ[]; v = [1..10^6]; f = R(v);
> sage: time g = f.change_ring(QQ)
> Time: CPU 0.05 s, Wall: 0.05 s
> sage: R.<x> = ZZ[]; v = [1..10^3]; f = R(v);
> sage: timeit('g = f.change_ring(QQ)')
> 625 loops, best of 3: 107 µs per loop
> }}}
>
> So we get nearly a 100-fold speedup.
>
> }}}

New description:

 I needed to massively optimize f.change_ring(QQ) for f in ZZ['x'] so that
 #11375 would not suck.

 For me,
 {{{
 BEFORE:
 sage: R.<x> = ZZ[]; v = [1..10^6]; f = R(v);
 sage: time g = f.change_ring(QQ)
 Time: CPU 4.39 s, Wall: 4.39 s
 sage: R.<x> = ZZ[]; v = [1..10^3]; f = R(v);
 sage: timeit('g = f.change_ring(QQ)')
 125 loops, best of 3: 1.79 ms per loop

 AFTER:
 sage: R.<x> = ZZ[]; v = [1..10^6]; f = R(v);
 sage: time g = f.change_ring(QQ)
 Time: CPU 0.05 s, Wall: 0.05 s
 sage: R.<x> = ZZ[]; v = [1..10^3]; f = R(v);
 sage: timeit('g = f.change_ring(QQ)')
 625 loops, best of 3: 107 µs per loop
 }}}

 So we get nearly a 100-fold speedup.

--

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/12265#comment:2>
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