Burcin and Mike -- Please read the below.  There is an absolutely
*MASSIVE* performance regression in pynac that Burcin surely caused.

On Fri, Apr 24, 2009 at 10:35 AM, Ondrej Certik <ond...@certik.cz> wrote:
>
> Hi,
>
> I am puzzled by this:
>
> ond...@raven:~$ sage
> ----------------------------------------------------------------------
> | Sage Version 3.4.1, Release Date: 2009-04-21                       |
> | Type notebook() for the GUI, and license() for information.        |
> ----------------------------------------------------------------------
> sage: var('x,y,z', ns=1)
> (x, y, z)
> sage: f = (x+y+z+1)^7
> sage: time g = expand(f*(f+1))
> CPU times: user 3.86 s, sys: 0.00 s, total: 3.86 s
> Wall time: 3.86 s
> sage:
> Exiting SAGE (CPU time 0m3.90s, Wall time 0m26.84s).
>
>
> ond...@raven:~$ sage
> ----------------------------------------------------------------------
> | Sage Version 3.4.1, Release Date: 2009-04-21                       |
> | Type notebook() for the GUI, and license() for information.        |
> ----------------------------------------------------------------------
> sage: var('x,y,z')
> (x, y, z)
> sage: f = (x+y+z+1)^7
> sage: time g = expand(f*(f+1))
> CPU times: user 0.07 s, sys: 0.02 s, total: 0.09 s
> Wall time: 1.23 s
> sage:
> Exiting SAGE (CPU time 0m0.12s, Wall time 0m9.59s).
> Exiting spawned Maxima process.
>
> ond...@raven:~$ sage
> ----------------------------------------------------------------------
> | Sage Version 3.4.1, Release Date: 2009-04-21                       |
> | Type notebook() for the GUI, and license() for information.        |
> ----------------------------------------------------------------------
> sage: from sympy import var, expand
> sage: var('x,y,z')
> (x, y, z)
> sage: f = (x+y+z+1)^7
> sage: time g = expand(f*(f+1))
> CPU times: user 3.23 s, sys: 0.03 s, total: 3.26 s
> Wall time: 3.27 s
> sage:
> Exiting SAGE (CPU time 0m3.36s, Wall time 0m30.75s).
>
>
> What am I doing wrong? Even pure python sympy is faster than pynac...

(1) You are not using sympy, for one:

> sage: var('x,y,z')
> (x, y, z)

Your var command doesn't inject x,y,z into the namespace!!

(2) I don't get the same times as you at all.  I get pynac being 4
times faster than Maxima and 5.56 times faster than Sympy on
sage.math.

wst...@sage:~$ sage
----------------------------------------------------------------------
| Sage Version 3.4.1, Release Date: 2009-04-21                       |
| Type notebook() for the GUI, and license() for information.        |
----------------------------------------------------------------------
sage: var('x,y,z', ns=1)
(x, y, z)
sage: f = (x+y+z+1)^7
sage: time g=expand(f*(f+1))
CPU times: user 0.74 s, sys: 0.00 s, total: 0.74 s
Wall time: 0.75 s
sage: var('x,y,z')
(x, y, z)
sage: f = (x+y+z+1)^7
sage: time g=expand(f*(f+1))
CPU times: user 0.09 s, sys: 0.01 s, total: 0.10 s
Wall time: 3.04 s
sage: from sympy import var, expand
sage: x,y,z=var('x,y,z')
sage: f = (x+y+z+1)^7
sage: time g = expand(f*(f+1))
CPU times: user 4.11 s, sys: 0.06 s, total: 4.17 s
Wall time: 4.17 s

These times are all pitiful compared to the time that Singular takes right now:

sage: R.<x,y,z> = QQ[]
sage: f = (x+y+z+1)^7
sage: time g = f*(f+1)        # also does "expand"
CPU times: user 0.00 s, sys: 0.00 s, total: 0.00 s
Wall time: 0.00 s

There was clearly a *major* performance regression, because in Sage-3.2:

wst...@sage:/disk/scratch/mabshoff-sage-releases/sage-3.2$ ./sage
----------------------------------------------------------------------
| Sage Version 3.2, Release Date: 2008-11-20                         |
| Type notebook() for the GUI, and license() for information.        |
----------------------------------------------------------------------

sage: var('x,y,z',ns=1)
(x, y, z)
sage: f = (x+y+z+1)^7
sage: time g=expand(f*(f+1))
CPU times: user 0.05 s, sys: 0.00 s, total: 0.05 s
Wall time: 0.05 s

I knew something was messed up about symbolics when I tried mhansen's
branch recently.  Burcin, what did you do!?

>
> I got one student working on a C++ core, so we wanted to benchmark it
> on something, but I am really confused by any benchmarks now, as
> obviously something stupid is happening above, but I only discovered
> that because the timings are so obviously slow. If they were faster, I
> wouldn't notice anything and I would happily use those timings as
> valid.
>
> Ondrej
>
> >
>



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

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

Reply via email to