You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The following code takes a very long time in Sage 4.4 up to and including 4.6:
sage: var('t')
sage: curva = vector((sin(2*t), cos(2*t), 0))
sage: M = identity_matrix(RDF,3)
sage: time M*curva
CPU times: user 0.02 s, sys: 0.00 s, total: 0.02 s
Wall time: 0.50 s
(sin(2*t), cos(2*t), 0)
The times depend on the computer, and decrease on the second call, but it is consistently, and significatively longer than the time required for:
sage: time sum(a*b for a,b in zip(curva,M.rows()))
CPU times: user 0.00 s, sys: 0.00 s, total: 0.00 s
Wall time: 0.00 s
(sin(2*t), cos(2*t), 0)
The first call is forwarded, I think to maxima. The waiting time is probably due to waiting for the maxima process. Profile revealed that most of the time was spent on "select.select".
sage: sage: var('t')
t
sage: sage: curva = vector((sin(2*t), cos(2*t), 0))
sage: sage: M = identity_matrix(RDF,3)
sage: %time M*curva
CPU times: user 0.72 s, sys: 0.02 s, total: 0.74 s
Wall time: 0.74 s
(sin(2*t), cos(2*t), 0)
sage: %timeit M*curva
100 loops, best of 3: 3.69 ms per loop
sage:
sage: %time sum(a*b for a,b in zip(curva,M.rows()))
CPU times: user 0.00 s, sys: 0.00 s, total: 0.00 s
Wall time: 0.00 s
(sin(2*t), cos(2*t), 0)
sage: %timeit sum(a*b for a,b in zip(curva,M.rows()))
1000 loops, best of 3: 279 us per loop
sage: var('t')
sage: curva = vector((sin(2*t), cos(2*t), 0))
sage: M = identity_matrix(RDF,3)
sage: %timeit M*curva
1000 loops, best of 3: 478 µs per loop
sage: %timeit sum(a*b for a,b in zip(curva,M.rows()))
1000 loops, best of 3: 321 µs per loop
after a restart of sage:
sage: var('t')
sage: curva = vector((sin(2*t), cos(2*t), 0))
sage: M = identity_matrix(RDF,3)
sage: %time M*curva
CPU times: user 6.67 ms, sys: 0 ns, total: 6.67 ms
Wall time: 4.67 ms
(sin(2*t), cos(2*t), 0)
sage: %time sum(a*b for a,b in zip(curva,M.rows()))
CPU times: user 3.33 ms, sys: 0 ns, total: 3.33 ms
Wall time: 3.77 ms
(sin(2*t), cos(2*t), 0)
So no significant difference here. Maybe because of an SSD.
The following code takes a very long time in Sage 4.4 up to and including 4.6:
The times depend on the computer, and decrease on the second call, but it is consistently, and significatively longer than the time required for:
The first call is forwarded, I think to maxima. The waiting time is probably due to waiting for the maxima process. Profile revealed that most of the time was spent on "select.select".
Component: performance
Issue created by migration from https://trac.sagemath.org/ticket/10947
The text was updated successfully, but these errors were encountered: