Working on ticket #15790 <http://trac.sagemath.org/ticket/15790>,¹ I've noticed that coercion from Sparse Polynomial Ring over ZZ to Dense Polynomial over ZZ with FLINT implementation is unexpectedly slow. It is not the case with the NTL implementation, and it is actually not the case either if we do not do coercion but simply define the same polynomial directly:

sage: R.<x> = PolynomialRing(ZZ,sparse=True)
sage: S.<y> = PolynomialRing(ZZ,implementation="FLINT")
sage: T.<z> = PolynomialRing(ZZ,implementation="NTL")
sage: f=x^100000

sage: %time S(f) # Coercion, with FLINT
CPU times: user 8.83 s, sys: 96 ms, total: 8.92 s
Wall time: 8.94 s
y^100000

sage: %time T(f) # Coercion, with NTL
CPU times: user 32.1 ms, sys: 0 ns, total: 32.1 ms
Wall time: 32.1 ms
z^100000

sage: %time _= y^100000 # Direct input, with FLINT
CPU times: user 624 µs, sys: 4 µs, total: 628 µs
Wall time: 637 µs

Despite the fact that this is way faster with NTL, the time complexity seems to be linear with NTL and quadratic with FLINT.

I haven't found where it may come from!
Cheers,
Bruno

¹ Btw, the ticket is ready to review, as well as #16516 <http://trac.sagemath.org/ticket/16516>. ;-)

--
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to