#9138: Categories for polynomial rings
--------------------------+-------------------------------------------------
   Reporter:  jbandlow    |       Owner:  nthiery                  
       Type:  defect      |      Status:  needs_info               
   Priority:  major       |   Milestone:  sage-4.7                 
  Component:  categories  |    Keywords:  introspection, categories
     Author:  Simon King  |    Upstream:  N/A                      
   Reviewer:              |      Merged:                           
Work_issues:              |  
--------------------------+-------------------------------------------------

Comment(by SimonKing):

 Here are the test results:

 Without all patches:
 {{{
 sage: R.<x> = ZZ[]
 sage: timeit('(2*x-1)^2+5')
 625 loops, best of 3: 22.5 µs per loop
 sage: R.<x> = QQ[]
 sage: timeit('(2*x-1)^2+5')
 625 loops, best of 3: 24.5 µs per loop
 sage: R.<x> = GF(3)[]
 sage: timeit('(2*x-1)^2+5')
 625 loops, best of 3: 87.7 µs per loop
 sage: R.<x> = QQ['t'][]
 sage: timeit('(2*x-1)^2+5')
 625 loops, best of 3: 114 µs per loop
 sage: R.<x,y> = ZZ[]
 sage: timeit('(2*x-1)^2+5')
 625 loops, best of 3: 21.9 µs per loop
 sage: R.<x,y> = QQ[]
 sage: timeit('(2*x-1)^2+5')
 625 loops, best of 3: 40 µs per loop
 sage: R.<x,y> = GF(3)[]
 sage: timeit('(2*x-1)^2+5')
 625 loops, best of 3: 26.3 µs per loop
 sage: R.<x,y> = QQ['t'][]
 sage: timeit('(2*x-1)^2+5')
 625 loops, best of 3: 239 µs per loop
 }}}

 With the patches from #9944:
 {{{
 sage: R.<x> = ZZ[]
 sage: timeit('(2*x-1)^2+5')
 625 loops, best of 3: 25.6 µs per loop
 sage: R.<x> = QQ[]
 sage: timeit('(2*x-1)^2+5')
 625 loops, best of 3: 26.7 µs per loop
 sage: R.<x> = GF(3)[]
 sage: timeit('(2*x-1)^2+5')
 625 loops, best of 3: 109 µs per loop
 sage: R.<x> = QQ['t'][]
 sage: timeit('(2*x-1)^2+5')
 625 loops, best of 3: 121 µs per loop
 sage: R.<x,y> = ZZ[]
 sage: timeit('(2*x-1)^2+5')
 625 loops, best of 3: 31.4 µs per loop
 sage: R.<x,y> = QQ[]
 sage: timeit('(2*x-1)^2+5')
 625 loops, best of 3: 40 µs per loop
 sage: R.<x,y> = GF(3)[]
 sage: timeit('(2*x-1)^2+5')
 625 loops, best of 3: 26.8 µs per loop
 sage: R.<x,y> = QQ['t'][]
 sage: timeit('(2*x-1)^2+5')
 625 loops, best of 3: 250 µs per loop
 }}}

 With the patches from #9944 and the patch from here:
 {{{
 sage: R.<x> = ZZ[]
 sage: timeit('(2*x-1)^2+5')
 625 loops, best of 3: 25.7 µs per loop
 sage: R.<x> = QQ[]
 sage: timeit('(2*x-1)^2+5')
 625 loops, best of 3: 28.3 µs per loop
 sage: R.<x> = GF(3)[]
 sage: timeit('(2*x-1)^2+5')
 625 loops, best of 3: 115 µs per loop
 sage: R.<x> = QQ['t'][]
 sage: timeit('(2*x-1)^2+5')
 625 loops, best of 3: 125 µs per loop
 sage: R.<x,y> = ZZ[]
 sage: timeit('(2*x-1)^2+5')
 625 loops, best of 3: 31 µs per loop
 sage: R.<x,y> = QQ[]
 sage: timeit('(2*x-1)^2+5')
 625 loops, best of 3: 17.5 µs per loop
 sage: R.<x,y> = GF(3)[]
 sage: timeit('(2*x-1)^2+5')
 625 loops, best of 3: 25.1 µs per loop
 sage: R.<x,y> = QQ['t'][]
 sage: timeit('(2*x-1)^2+5')
 625 loops, best of 3: 256 µs per loop
 }}}

 Note, however, that the numbers arent't very stable
 {{{
 sage: R.<x,y> = QQ[]
 sage: timeit('(2*x-1)^2+5')
 625 loops, best of 3: 20.9 µs per loop
 sage: timeit('(2*x-1)^2+5')
 625 loops, best of 3: 20.8 µs per loop
 sage: timeit('(2*x-1)^2+5')
 625 loops, best of 3: 22.6 µs per loop
 sage: timeit('(2*x-1)^2+5')
 625 loops, best of 3: 37.9 µs per loop
 sage: timeit('(2*x-1)^2+5')
 625 loops, best of 3: 15.4 µs per loop
 }}}

 But there is a tendency: Things tend to be slower, both with #9944 and
 with my patch.

 So, it should be worth while to analyse the arithmetic with prun.

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