On Nov 30, 2006, at 9:40 PM, William Stein wrote:
>> If it's 1MB per ring, then I only have to be >> working modulo 500 or so integers simultaneously --- not at all a >> far- >> fetched situation --- before my typical desktop PC runs out of RAM. > > We could only automatically cache up to 50 rings, say. If the user > *wants* caching, they can always explicitly ask for it, and if they > don't they can always explicitly ask not to have it. > > sage: Integers(97, cache=False) > sage: Integers(97, cache=True) > > if you are explicitly about casting then either option should > be respected. If you don't specify anything for cache, it could > use some rules, such as suggested above. OK, I could live with that. > On the other hand, if you create a large number of elements modulo one > integer with the caching you won't run out of memory, whereas without > it you might very well run out. I'm not so sure about this. If you cache, then every IntegerMod is a Python object containing a pointer that points to the cached object. If you don't cache, then every IntegerMod is a Python object containing a single machine word describing which element it is. Am I missing something here? Have I been spending too long away from python/pyrex? >> We got some of the way towards solving this problem at SAGE >> Days 2. Much of the work has been done for the Integer class. I hope >> that someone can put some effort into generalising and improving >> those efforts. I don't have the time right now to work on this. > > I pushed that same work through to most other compiled classes. > E.g., Python's own ints with their caching etc., do the benchmark > mentioned above in 0.70 seconds, so now SAGE's object creation isn't > that far off from Python's own built-in optimized object creation. I didn't realise that work had already been done. Thanks for doing that! It's really incredible that MAGMA goes faster than python ints here. From memory, at sage days 2, our Integer stuff was still a factor of 7-10 away from python ints, at least for addition. David --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to [email protected] 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/ -~----------~----~----~----~------~----~------~--~---
