On Dec 1, 2006, at 5:27 AM, William Stein wrote: > On Fri, 01 Dec 2006 05:11:58 -0800, David Harvey > <[EMAIL PROTECTED]> wrote:
[...] > Also -- the work you did there was useful for all of SAGE, since I was > able to, e.g., propogate use of PY_NEW all over the place with almost > no trouble, for an immediate huge speedup. > >> There are a few issues: >> >> (1) I don't have time to work on this now :-) > > Same here. > >> (2) There is the problem of mpz_t allocation time too, which is an >> independent but related problem. > > This may be a serious issue. It might be worth looking into how python handles their short/long ints too, so small ints wouldn't even need an mpz_t allocation. With caching, I'd imagine the mpz_t's could remain allocated. Also, I think mpz_size could be a very fast way to tell if a reclaimed integer should be zeroed to free memory. >> (3) If we really did want to use a python-int-like allocation >> strategy for SAGE Integers, it would be difficult to reconcile that >> with a pyrex implementation. I haven't thought about it too >> carefully, but I think what we would need to do is write a few >> functions in pure C, and then make some of Integer's tp* slots point >> to those functions, to override pyrex's implementations. It would be >> a bit fragile. One difficulty is that I don't know exactly when those >> function reassignments would take place, and maybe there already >> would be Integer objects hanging around.... ugh. > > I'm not opposed to SAGE integers being written entirely in C if that > is what it takes. Though I prefer solutions that can work in the > context of SageX, since they are much faster to deploy and can benefit > more code. Also, maybe the above suggests a way in which SageX could > be changed to better accomodate optimization. I.e., there could be > a facility for explicitly specifying how tp* slots should be filled > in. > > -- 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/ -~----------~----~----~----~------~----~------~--~---