Basic arithmetic in libSingular seems to be slower than in Singular (used via pexpect):
sage: P.<x,y,z> = QQ[]
sage: def test1(x,y,z):
....: for i in range(100):
....: p = (x+y+z)^i
....:
sage: def test2(x,y,z):
....: x = singular(x)
....: y = singular(y)
....: z = singular(z)
....: for i in range(100):
....: p = (x+y+z)^i
....:
sage: %time test1(x,y,z)
CPU times: user 2.66 s, sys: 0.00 s, total: 2.66 s
Wall time: 2.67 s
sage: %time test2(x,y,z)
CPU times: user 0.15 s, sys: 0.08 s, total: 0.23 s
Wall time: 1.94 s
These timings were with sage-4.6.2, but they are similar with sage-4.7.2.alpha_whatever. Martin confirms these timings, and finds that similar things also occur with multiplication.
Citing Martin:
However, mod p it seems libSingular wins. Hence my guess:
we are using different memory allocation functions for GMP
and these functions might be slower (for Singular's use case)?
Basic arithmetic in
libSingular
seems to be slower than in Singular (used via pexpect):These timings were with sage-4.6.2, but they are similar with sage-4.7.2.alpha_whatever. Martin confirms these timings, and finds that similar things also occur with multiplication.
Citing Martin:
Component: commutative algebra
Issue created by migration from https://trac.sagemath.org/ticket/11957