Re,

I've noticed that the slowness is actually also function of the number of 
terms, in a surprising way:

sage: R.<x> = PolynomialRing(ZZ,sparse=True)
sage: S.<y> = PolynomialRing(ZZ,implementation="FLINT")

sage: f = x^100000
sage: %time _ = S(f)
CPU times: user 8.71 s, sys: 2.84 ms, total: 8.72 s
Wall time: 8.72 s

sage: f = x^100000 + R.random_element(99999)
sage: %time _ = S(f)
CPU times: user 34.4 ms, sys: 8.08 ms, total: 42.4 ms
Wall time: 37.4 ms

sage: f = R.random_element(100).subs(x=x^1000)
sage: %time _ = S(f)
CPU times: user 141 ms, sys: 0 ns, total: 141 ms
Wall time: 141 ms


I am still unable to find where it comes from!

Cheers,
Bruno


Le samedi 13 décembre 2014 16:05:09 UTC+1, Bruno Grenet a écrit :
>
>  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