[sage-devel] Re: Speeding up integer arithmetic

2006-10-12 Thread William Stein
On Thu, 12 Oct 2006 10:36:53 -0700, Justin C. Walker <[EMAIL PROTECTED]> wrote: >> This "final word" might take a while: omalloc is not a shared >> library and thus >> I either have to make it one or link it in statically which >> probably won't >> work at all (because this would result in sever

[sage-devel] Re: Speeding up integer arithmetic

2006-10-12 Thread Martin Albrecht
On Thursday 12 October 2006 17:36, Justin C. Walker wrote: > On Oct 12, 2006, at 09:34 , Martin Albrecht wrote: > >> Guys, this is not where the bulk of our time is at the moment. The > >> bulk of our time now is in constructing the *Python* object, not in > >> constructing or managing the underly

[sage-devel] Re: Speeding up integer arithmetic

2006-10-12 Thread Justin C. Walker
On Oct 12, 2006, at 09:34 , Martin Albrecht wrote: > >> Guys, this is not where the bulk of our time is at the moment. The >> bulk of our time now is in constructing the *Python* object, not in >> constructing or managing the underlying GMP object. The python >> integer type manages to avoid con

[sage-devel] Re: Speeding up integer arithmetic

2006-10-12 Thread William Stein
On Thu, 12 Oct 2006 09:34:34 -0700, Martin Albrecht <[EMAIL PROTECTED]> wrote: >> Guys, this is not where the bulk of our time is at the moment. The >> bulk of our time now is in constructing the *Python* object, not in >> constructing or managing the underlying GMP object. The python >> integer

[sage-devel] Re: Speeding up integer arithmetic

2006-10-12 Thread Martin Albrecht
> Guys, this is not where the bulk of our time is at the moment. The > bulk of our time now is in constructing the *Python* object, not in > constructing or managing the underlying GMP object. The python > integer type manages to avoid constructing Python objects altogether > in most cases (it reu

[sage-devel] Re: Speeding up integer arithmetic

2006-10-12 Thread R Rishikesh
I was also suggesting that sage do it transparently. That is the user is not expected to identify the intermediate object and write code for it, but that sage translates it to the code with reusable intermediate objects. Rishi On 10/12/06, William Stein <[EMAIL PROTECTED]> wrote: > > There have

[sage-devel] Re: Speeding up integer arithmetic

2006-10-12 Thread William Stein
There have been proposals for mutable integers, and that's what you're suggesting below. I think there should be a class MutableInteger that derives from integer and is mutable. These would offer some ops like you suggest below. -- William On Thu, 12 Oct 2006 08:06:50 -0700, R Rishik

[sage-devel] Re: Speeding up integer arithmetic

2006-10-12 Thread R Rishikesh
It may be possible to minimize the intermediate object creation by introducing intermediate objects at the beginning of a block and reusing them (especially in loops). example for i in range(100): f(a+i) is translated to c=0 for i in range(100): c.set_to_sum(a,i) This reduce

[sage-devel] Re: Speeding up integer arithmetic

2006-10-12 Thread David Harvey
On Oct 12, 2006, at 8:39 AM, [EMAIL PROTECTED] wrote: > > On Thursday 12 October 2006 02:55, Craig Citro wrote: >> As far as speeding up arithmetic >> with integers, there's one "known" trick that people use, namely >> switching >> between boxed & unboxed integers. > > Yeah, this was my sugges

[sage-devel] Re: Speeding up integer arithmetic

2006-10-12 Thread sage
On Thursday 12 October 2006 02:55, Craig Citro wrote: > As far as speeding up arithmetic > with integers, there's one "known" trick that people use, namely switching > between boxed & unboxed integers. Yeah, this was my suggestion as well.  It seems to me that it's a hands-down win if you mostly