David, I re-installed sage-3.0.2 from source and then ran your test
against
sage-3.0.1 and sage-3.0.2.  The run times were comparable.

[EMAIL PROTECTED] sage]$ /home/daryl/sage-3.0.1/sage
----------------------------------------------------------------------
| SAGE Version 3.0.1, Release Date: 2008-05-05                       |
| Type notebook() for the GUI, and license() for information.        |
----------------------------------------------------------------------

sage: x = ZZ.random_element(2^4000000)
sage: y = ZZ.random_element(2^4000000)
sage: time z = x.xgcd(y)
CPU times: user 12.84 s, sys: 0.11 s, total: 12.94 s
Wall time: 13.02
sage: quit
Exiting SAGE (CPU time 0m12.98s, Wall time 1m9.88s).
[EMAIL PROTECTED] sage]$ /home/daryl/sage-3.0.2/sage
----------------------------------------------------------------------
| SAGE Version 3.0.2, Release Date: 2008-05-24                       |
| Type notebook() for the GUI, and license() for information.        |
----------------------------------------------------------------------

sage: x = ZZ.random_element(2^4000000)
sage: y = ZZ.random_element(2^4000000)
sage: time z = x.xgcd(y)
CPU times: user 12.92 s, sys: 0.12 s, total: 13.04 s
Wall time: 13.10 s
sage: quit
Exiting SAGE (CPU time 0m13.07s, Wall time 0m51.21s).


I then ran my sieve program against both sage-3.0.1 and sage-3.0.2 and
my
results still show increased elapsed/cpu times for sage-3.0.2:

/home/daryl/sage-3.0.1/sage /home/daryl/UserData/sage/sieve.sage

============================================
SAGE Version 3.0.1, Release Date: 2008-05-05

Start time:       Fri Jul  4 19:18:47 2008

Array size:       10000000

Create array:     Fri Jul  4 19:19:04 2008
Create seconds:   16.99

Mark primes:      Fri Jul  4 19:19:42 2008
Mark seconds:     38.28

Count primes:     Fri Jul  4 19:20:00 2008
Count seconds:    17.65

Number of primes: 664579

End time:         Fri Jul  4 19:20:00 2008
Elapsed seconds:  72.92

============================================

/home/daryl/sage-3.0.2/sage /home/daryl/UserData/sage/sieve.sage

============================================
SAGE Version 3.0.2, Release Date: 2008-05-24

Start time:       Fri Jul  4 19:20:06 2008

Array size:       10000000

Create array:     Fri Jul  4 19:20:31 2008
Create seconds:   25.36

Mark primes:      Fri Jul  4 19:21:43 2008
Mark seconds:     71.26

Count primes:     Fri Jul  4 19:22:11 2008
Count seconds:    28.95

Number of primes: 664579

End time:         Fri Jul  4 19:22:11 2008
Elapsed seconds:  125.57

============================================

It appears that you are correct that the testing and changing I did on
Thursday
to the sage-3.0.2 gmp code somehow corrupted/regressed it.


Finally I spent several hours trying to reduce the SAGE code down to
the
smallest number of lines that would still present the problem.  I
believe I've
done that with the following:

cat /home/daryl/UserData/sage/add.sage
# 2008-07-04 DWH Created to test out integer arithmetic

from time import *

y = range(10 * 1000 * 1000)

#--------------------------
tbeg = time()
for _ in y:
    x = 1
#--------------------------
tmid = time()
for _ in y:
    x = 1 + 1
#--------------------------
tend = time()

elapsed = tmid - tbeg
print '10M x=1:  ', round(elapsed,2)
elapsed = tend - tmid
print '10M x=1+1:', round(elapsed,2)


/home/daryl/sage-3.0.1/sage /home/daryl/UserData/sage/add.sage
10M x=1:   6.17
10M x=1+1: 12.92
/home/daryl/sage-3.0.2/sage /home/daryl/UserData/sage/add.sage
10M x=1:   6.22
10M x=1+1: 19.78


The two sections of code differ by a single line: x = 1 vs. x = 1 + 1.
Running on a 2.8 Ghz P4:
for x = 1 the times are the same;
for x = 1 + 1 the times differ by 6.86 seconds (a 53% increase).

However, when that 6.86 seconds is divided by 10,000,000 a single x =
1 + 1 is
only taking .686 micro seconds longer.  Depending on how you use SAGE/
gmp, the
observable results will differ.  Adding or multiplying a couple of
really big
numbers won't show a perceptible difference.  Adding or multiplying
tens of
millions of numbers will cause the difference to add up.

In the case of my sieve program, loop control (adding 1) made up a
substantial
portion of the total code.

I'll let someone else decide whether this result in sage-3.0.2 is a
bug or a
feature (a feature being a bug in a tuxedo).

-Daryl

--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-support@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-support
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to