On 10/26/07, David Harvey <[EMAIL PROTECTED]> wrote:
> sage: N = 5^1000
> sage: R = Integers(N)
> sage: S.<x> = PolynomialRing(R)
> sage: v = R(37)
> sage: f = S([v])
>
> Am I correct in saying that with the current codebase, the last line
> in the above code is converting v to a ZZ_pX via a decimal string?

Instead do this so the problem is more pronounced:

sage: N = 5^100000
sage: R = Integers(N)
sage: S.<x> = PolynomialRing(R)
sage: v = R(7^100000)
sage: time f = S([v])

I then tracked down the problem which is in the ntl_ZZ_pContext
function in ntl_ZZ_pContext.pyx, where the context is cached.
Unfortunately, the frickin' context is cached as a decimal *string*, so
every single cached access to the context is extremely expensive -- for
more expensive than not even bothing to cache the context would be.
The patch that will soon appear here:

   http://trac.sagemath.org/sage_trac/ticket/1009

will fix things so that the cache uses the hash of the context, which
I implemented (along with hash's of ntl_ZZ's).

Exactly the same mistake is made in ntl_GF2EContext.pyx, which the
above patch also fixes, hopefully.

 -- William

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