On Tue, 06 Feb 2007 20:58:31 -0700, Alec Mihailovs <[EMAIL PROTECTED]> wrote:
> SAGE's version of Python in cygwin seem to be very slow.

Are you starting "SAGE's version of Python" with "sage -python" and
typing there, are are you running that same function from the SAGE
command prompt?  Please try "sage -python" and report back.

If you're using the SAGE command prompt, it's important to either
set the constants outside of the loop (they all get wrapped in
Integer( ... ), which slows things down), or put an r after them
to make them raw literals.    (We intend to automatically factor
out setting of constants, but haven't implemented that yet.)

> Look at the following time comparison for the following Python function,
>
> def m(n):
> ....:      return [[j%n*n+(j+j-i)%n+1
> ....:         for j in range(i+(1-n)/2,i+(n+1)/2)] for i in range(n)]
>
> First - in cygwin's ipython running cygwin's python,
>
> In [7]: time a=m(201)
> CPU times: user 0.03 s, sys: 0.00 s, total: 0.03 s
> Wall time: 0.04
>
> In [8]: time a=m(1001)
> CPU times: user 0.83 s, sys: 0.02 s, total: 0.84 s
> Wall time: 0.86
>
> Now - in SAGE,
>
> sage: time a=m(201)
> CPU times: user 1.83 s, sys: 1.38 s, total: 3.20 s
> Wall time: 3.23
> sage: time a=m(1001)
> CPU times: user 44.34 s, sys: 37.17 s, total: 81.51 s
> Wall time: 81.77
>
> Alec Mihailovs
> http://mihailovs.com/Alec/
>
>
>
> >
>



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