#6063: x^2 for x over QQ is really frickin' slow compared to over ZZ (nearly
factor of 100!!)
------------------------------+---------------------------------------------
Reporter: was | Owner: somebody
Type: defect | Status: new
Priority: major | Milestone: sage-4.0.1
Component: basic arithmetic | Keywords:
------------------------------+---------------------------------------------
{{{
wst...@sage:~$ sage
----------------------------------------------------------------------
| Sage Version 3.4.1, Release Date: 2009-04-21 |
| Type notebook() for the GUI, and license() for information. |
----------------------------------------------------------------------
sage: R.<x> = ZZ[]
sage: timeit('x^2')
625 loops, best of 3: 1.4 µs per loop
sage: R.<x> = QQ[]
sage: timeit('x^2')
625 loops, best of 3: 118 µs per loop
sage: %prun x**2
34 function calls in 0.001 CPU seconds
Ordered by: internal time
ncalls tottime percall cumtime percall filename:lineno(function)
1 0.000 0.000 0.001 0.001 <string>:1(<module>)
1 0.000 0.000 0.000 0.000
polynomial_element_generic.py:590(__init__)
4 0.000 0.000 0.000 0.000
polynomial_element_generic.py:656(__getitem__)
3 0.000 0.000 0.000 0.000 {method 'poldegree' of
'sage.libs.pari.gen.gen' objects}
3 0.000 0.000 0.000 0.000
polynomial_element_generic.py:874(degree)
2 0.000 0.000 0.000 0.000 {method 'Polrev' of
'sage.libs.pari.gen.gen' objects}
1 0.000 0.000 0.000 0.000
polynomial_ring.py:211(_element_constructor_)
1 0.000 0.000 0.000 0.000 polynomial_ring.py:741(gen)
9 0.000 0.000 0.000 0.000 {isinstance}
3 0.000 0.000 0.000 0.000 {max}
1 0.000 0.000 0.000 0.000 {hasattr}
1 0.000 0.000 0.000 0.000
polynomial_ring.py:810(is_sparse)
1 0.000 0.000 0.000 0.000 {method 'type' of
'sage.libs.pari.gen.gen' objects}
1 0.000 0.000 0.000 0.000 {len}
1 0.000 0.000 0.000 0.000
{sage.rings.fraction_field_element.is_FractionFieldElement}
1 0.000 0.000 0.000 0.000 {method 'disable' of
'_lsprof.Profiler' objects}
sage: R.<x> = ZZ[]
sage: %prun x**2
3 function calls in 0.000 CPU seconds
Ordered by: internal time
ncalls tottime percall cumtime percall filename:lineno(function)
1 0.000 0.000 0.000 0.000 <string>:1(<module>)
1 0.000 0.000 0.000 0.000 polynomial_ring.py:741(gen)
1 0.000 0.000 0.000 0.000 {method 'disable' of
'_lsprof.Profiler' objects}
}}}
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/6063>
Sage <http://sagemath.org/>
Sage - Open Source Mathematical Software: Building the Car Instead of
Reinventing the Wheel
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---