On Thu, Oct 27, 2011 at 12:57 PM, Volker Braun <vbraun.n...@gmail.com> wrote:
> On Thursday, October 27, 2011 1:38:34 PM UTC-4, Martin Albrecht wrote:
>>
>> Sure, but it's still worrisome that a computation is slower in libSingular
>> than in Singular.
>
> Just to reiterate in case I wasn't clear, as long as the "computation in
> Singular" just references a singular variable as output and "libsingular"
> converts the output to Sage datastructures the latter is always going to be
> slower.

That is not what is happening here.  libsingular is definitely not
converting the output to Sage datastructures.  The Sage polynomials
x,y,z are simply Cython level wrappers around a pure Singular
datastructure.

sage: type(x)
<type 
'sage.rings.polynomial.multi_polynomial_libsingular.MPolynomial_libsingular'>

I'm pretty surprised by this benchmark.

The timing difference on my computer is even more:

sage: time test1(x,y,z)
Time: CPU 4.89 s, Wall: 4.89 s
sage: time test2(x,y,z)
Time: CPU 0.15 s, Wall: 1.73 s

It really comes down to this (following exactly the code that Simon posted):

sage: time v = (x+y+z)^100
Time: CPU 0.23 s, Wall: 0.23 s
sage: xx=singular(x);yy=singular(y);zz=singular(z)
sage: time v = (xx+yy+zz)^100
Time: CPU 0.00 s, Wall: 0.06 s

Why is exponentiation dramatically faster in case 2 than 1?   Note
that the *wall time* is what matters in both cases, by the way.

 -- William

> A good benchmark would be e.g. computing the dimension of some idea
> where there is not much output.
> Also, timing finally finished:
> sage: timeit('test1(*P.gens())')
> 5 loops, best of 3: 2.2 s per loop
> sage: timeit('test2(*P.gens())')
> 5 loops, best of 3: 1.49 s per loop
> sage: timeit('test3(*P.gens())')
> 5 loops, best of 3: 32.3 s per loop
>
> --
> To post to this group, send an email to sage-devel@googlegroups.com
> To unsubscribe from this group, send an email to
> sage-devel+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/sage-devel
> URL: http://www.sagemath.org
>



-- 
William Stein
Professor of Mathematics
University of Washington
http://wstein.org

-- 
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org

Reply via email to