On 3/27/07, Joel B. Mohler <[EMAIL PROTECTED]> wrote:
> [EMAIL PROTECTED]:~$ magma
> Magma V2.13-5     Tue Mar 27 2007 07:12:02 on sage     [Seed = 1950028839]
> Type ? for help.  Type <Ctrl>-D to quit.
> > C<I>:=QuadraticField(-1);
> > time for x in [1..100000] do a:=I*I; end for;
> Time: 0.260
> > time for x in [1..100000] do a:=I/2; end for;
> Time: 0.370
> > time for x in [1..100000] do a:=1+1; end for;
> Time: 0.020

Joel,

If you want to time what PARI is really capable of, ignoring all issues
of SAGE and memory management that might get in the way, you
should do tests like this:

sage: gp.eval('k=Mod(x,x^2+1); gettime; for(i=1,10^5,b=k*k);
print(gettime/1000.0)')
'0.260000000000000000000000000'

Interestingly, PARI is *exactly* the same speed as MAGMA,
and it's better than MAGMA at the divide by 2 tests (probably because
there's less implicit conversion code going in on PARI):

sage: gp.eval('k=Mod(x,x^2+1); gettime; for(i=1,10^5,b=k/2);
print(gettime/1000.0)')
'0.15600000000000000000000000000000000000'

You could get timings like above (+Python object creation time!)
by directly writing your .pyx number field element wrapper
to use the PARI C library.   You would want to do this in a way
that deals sensibly with the really subtle issues involved in PARI's (lack of?)
memory management, and hopefully doesn't mess up the SAGE pari
wrapper in gen.pyx.

Anyway, I'm just letting you know that this is another potentially viable
option to pursue if you want frickin' fast number field arithmetic in SAGE.

-- William



>
> [EMAIL PROTECTED]:~$ sage
> ----------------------------------------------------------------------
> | SAGE Version 2.4, Release Date: 2007-03-25                         |
> | Type notebook() for the GUI, and license() for information.        |
> ----------------------------------------------------------------------
> Loading SAGE library. Current Mercurial branch is: nf
> sage: C.<I>=QuadraticField(-1)
> sage: time for i in xrange(100000): a=I*I
> CPU times: user 1.80 s, sys: 0.02 s, total: 1.82 s
> Wall time: 1.82
> sage: two=2
> sage: time for i in xrange(100000): a=I/two
> CPU times: user 9.94 s, sys: 0.13 s, total: 10.07 s
> Wall time: 10.07
> sage: one=1
> sage: time for i in xrange(100000): a=one+one
> CPU times: user 0.10 s, sys: 0.01 s, total: 0.11 s
> Wall time: 0.11
>

--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-devel@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://sage.scipy.org/sage/ and http://modular.math.washington.edu/sage/
-~----------~----~----~----~------~----~------~--~---

Reply via email to