Bill Allombert on Thu, 16 Feb 2012 01:35:26 +0100

[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: Question on subst(), deferred evaluation and trap()

On Wed, Feb 15, 2012 at 04:19:05PM -0800, Jack Brennen wrote:
> On 2/15/2012 12:25 PM, Bill Allombert wrote:
> >>So far, the best I've come up with is:
> >>
> >>   V=[1/(x-1),1/(x-2),1/(x-3)];
> >>
> >>And then instead of a simple subst() on V, I use:
> >>
> >>   N=3;vector(#V,j,trap(,0,subst(V[j],x,N)))
> >>
> >>However, for cases where the trap is not taken, my method is about
> >>10 times slower than just doing subst(V,x,N).
> >
> >So your problem boils down to performance.
> >What is your OS and PARI/GP version ?
> >
> >I ask because it seems trap is much slower on your system than on our test systems.
> >
> Yeah, it's just a performance issue.  My solution works, but
> 10x slowdown is hard to take.
> That particular timing number was from 2.3.5-release, on FreeBSD
> 8.2-RELEASE, Intel i3-550 @ 3.2 GHz.
> Karim's response about a potential solution in 2.5 may prompt me
> to update to the latest PARI.

You should in any case, even though I do not think using apply to be any faster than 

What you can do is to replace setjmp by _setjmp and longjmp by _longjmp everywhere in
the PARI code and see if it is faster on FreeBSD.