On Jul 5, 2008, at 3:27 AM, Daryl Hammond wrote:

> 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

Alright. Now some debugging by mailing list :-)

(1)
try the x = 1+1 loop *without* the x = 1, and check you still get the  
discrepancy between 3.0.1 and 3.0.2.

If so, let's ignore the x = 1 code from here on, and concentrate on  
the x = 1+1.

(2)
in between each invocation, delete the autogenerated sieve.py file,  
and check that both 3.0.1 and 3.0.2 are generating essentially the  
same sieve.py file
(it should be something like x = Integer(1) + Integer(1))

(3)
increase the loop count to 100 million, and run "top" while the  
program is running, and keep an eye on the memory usage (for both  
3.0.1 and 3.0.2). I want to see if there are any memory leaks. Also  
check that there aren't any other processes (especially "lisp.run")  
hogging cpu during the loop.

(4)
Assuming we haven't found anything interesting yet, now I want to try  
a few variants of the main loop. Try each of these in a separate  
program, for both 3.0.1 and 3.0.2, and let me know if any of them  
slow down:

y = range(10^7)
for _ in y:
    x = 1 + 2

y = range(10^7)
one = Integer(1)
for _ in y:
     x = one + one

y = range(10^7)
one = Integer(1)
for _ in y:
     x = one + 1

y = range(7)
one = int(1)
for _ in y:
     x = one + one

y = range(7)
one = Integer(1)
for _ in y:
     x = one.__add__(one)

david


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