#8158: efficiency problem with polynomials (SymbolicRing vs PolynomialRing)
---------------------------------------+------------------------
Reporter: zimmerma | Owner: malb
Type: defect | Status: new
Priority: major | Milestone: sage-6.2
Component: commutative algebra | Resolution:
Keywords: | Merged in:
Authors: | Reviewers:
Report Upstream: N/A | Work issues:
Branch: | Commit:
Dependencies: | Stopgaps:
---------------------------------------+------------------------
Comment (by mmezzarobba):
I doubt there is much to do here except reduce the overhead of the
singular interface (especially regarding memory management) or singular
itself. On my system, ginac (1.6.2) is already faster than singular
(3.1.6):
{{{
> time(expand((a+b+c+1)^100));
1.184s
}}}
{{{
> timer=1;
> ring r=0,(a,b,c),lp;
> poly p=(a+b+c+1)^100;
//used time: 1.95 sec
}}}
Both interfaces have comparable overhead (sage 6.2.beta4):
{{{
sage: %time _=expand((a+b+c+1)^100)
CPU times: user 3.13 s, sys: 16 ms, total: 3.14 s
Wall time: 3.14 s
}}}
{{{
sage: P.<a,b,c> = PolynomialRing(QQ,order='lex')
sage: %time _=(a+b+c+1)^100
CPU times: user 5.59 s, sys: 8 ms, total: 5.6 s
Wall time: 5.59 s
}}}
but not for the same reason—the advantage of standalone singular over
libsingular called from sage seems to be due in large part to its faster
memory allocator, and we can make the singular version significantly
faster by forcing sage to use tcmalloc instead of the system malloc():
{{{
$ LD_PRELOAD="/usr/lib/libtcmalloc.so.4" sage
...
sage: var('a,b,c')
(a, b, c)
sage: %time _=expand((a+b+c+1)^100)
CPU times: user 2.89 s, sys: 36 ms, total: 2.92 s
Wall time: 2.92 s
sage: P.<a,b,c> = PolynomialRing(QQ,order='lex')
sage: %time _=(a+b+c+1)^100
CPU times: user 3.4 s, sys: 12 ms, total: 3.41 s
Wall time: 3.41 s
}}}
--
Ticket URL: <http://trac.sagemath.org/ticket/8158#comment:4>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.