I recently did a clean install of Fedora 9 (formerly running Fedora 8)
and then
installed sage-3.0.3 from source (formerly running sage-3.0).  After
running
"sage -testall" I ran a couple of my own programs.

I was surprised to see one of the programs (sieve of Erasthenes) run
70% longer.
I installed sage-3.0 from source and verified that sage-3.0.3 was
indeed taking
70% longer to run the sieve program than sage-3.0 did.

To narrow down the problem, I installed sage-3.0.1 and sage-3.0.2,
both from
source.  I then determined the performance problem was introduced
going from
sage-3.0.1 to sage-3.0.2.

The following doc shows my system; output from the sieve progam under
sage-3.0, sage-3.0.1, sage-3.0.2, and sage-3.0.3; and source for the
sieve
program.

The system has a single user, no load, no swapping, and the
performance monitor
indicates that the CPU (2.8 GHz P4) is pegged during the entire
elapsed time.

uname -a
Linux DH04.HAMMOND 2.6.25-14.fc9.i686 #1 SMP Thu May 1 06:28:41 EDT
2008 i686 i686 i386 GNU/Linux

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

============================================
SAGE Version 3.0, Release Date: 2008-04-23

Start time:       Wed Jul  2 17:17:52 2008

array size:       10000000
number of primes: 664580

End time:         Wed Jul  2 17:19:03 2008
Elapsed seconds:  70.93

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

/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:       Wed Jul  2 17:19:18 2008

array size:       10000000
number of primes: 664580

End time:         Wed Jul  2 17:20:30 2008
Elapsed seconds:  72.58

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

/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:       Wed Jul  2 17:20:47 2008

array size:       10000000
number of primes: 664580

End time:         Wed Jul  2 17:22:53 2008
Elapsed seconds:  126.51

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

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

============================================
SAGE Version 3.0.3, Release Date: 2008-06-17

Start time:       Wed Jul  2 17:23:09 2008

array size:       10000000
number of primes: 664580

End time:         Wed Jul  2 17:25:14 2008
Elapsed seconds:  124.39

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

cat /home/daryl/UserData/sage/sieve.sage
#!/usr/bin/env sage

# sieve of Erasthenes

# 2008/04/29 DWH Switch from numerical array to character array for
primes;
#                Switch from srange() to while loop.
#
#-------------------------------------------------------------------------------

from time import *

# print start time

print
print '============================================'
print version()
print
start = time()
print 'Start time:      ', ctime(start)
print

#create prime array p of size n and initialize to '1'

n = 10 * 1000 * 1000
print 'array size:      ', n
p = list()
array_ctr = -1
while array_ctr < n:
    array_ctr = array_ctr + 1
    p.append('1')

# initialize first two array elements to '0'

p[0] = '0'
p[1] = '0'

# assign '0' to non-prime numbers

q = 1
while q * q < n:
    q = q + 1
    if p[q] == '1':
        z = q * q - q
        while z + q < n:
            z = z + q
            p[z] = '0'

# count primes and print count

ctr = 0
array_ctr = -1
while array_ctr < n:
    array_ctr = array_ctr + 1
    if p[array_ctr] == '1':
        ctr = ctr + 1

print 'number of primes:', ctr

# print end time

print
end = time()
print 'End time:        ', ctime(end)
elapsed = end - start
print 'Elapsed seconds: ', round(elapsed,2)
print
print '============================================'
print


-Daryl Hammond
--~--~---------~--~----~------------~-------~--~----~
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