On Tue, Mar 27, 2007 at 07:36:18AM -0700, William Stein wrote: > > > On 3/27/07, Joel B. Mohler <[EMAIL PROTECTED]> wrote: > > P.S.: Speed comparisons (all on sage.math). I've included the basic integer > > In all your timings below that involve a constant (e.g., 1 or 2), you > should factor > out the constant from the test. E.g., do a = 1; b = 2; then do the > test with a and b. > Otherwise the Integer( ) function is being called every time on a Python int, > and you're (1) testing the wrong thing, and (2) testing something that won't > reflect how actual code will behave.
Good point! Corrected timings are below. That explains why the number field arithmetic was slower by a smaller multiplicative factor. [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 [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/ -~----------~----~----~----~------~----~------~--~---