Re: [Numpy-discussion] Surprising performance tweak in Cython

2008-06-23 Thread Gael Varoquaux
On Mon, Jun 23, 2008 at 02:03:06AM -0400, Anne Archibald wrote: > One way to track down this kind of problem is to look at the C code > that's generated. Easier, I admit, with a little familiarity with C, > but in any case code working with python variables will be obtrusively > strewn with functio

Re: [Numpy-discussion] Surprising performance tweak in Cython

2008-06-22 Thread Anne Archibald
2008/6/23 Gael Varoquaux <[EMAIL PROTECTED]>: > On Sun, Jun 22, 2008 at 06:39:21PM -1000, Eric Firing wrote: >> Another typo is the culprit: > >> In [2]:timeit do_Mandelbrot_cython() >> 10 loops, best of 3: 53.8 ms per loop > >> In [3]:timeit do_Mandelbrot_cython2() >> 10 loops, best of 3: 54 ms pe

Re: [Numpy-discussion] Surprising performance tweak in Cython

2008-06-22 Thread Gael Varoquaux
On Sun, Jun 22, 2008 at 06:39:21PM -1000, Eric Firing wrote: > Another typo is the culprit: > In [2]:timeit do_Mandelbrot_cython() > 10 loops, best of 3: 53.8 ms per loop > In [3]:timeit do_Mandelbrot_cython2() > 10 loops, best of 3: 54 ms per loop > This is after I put the underscore in the x_b

Re: [Numpy-discussion] Surprising performance tweak in Cython

2008-06-22 Thread Eric Firing
Gael, Another typo is the culprit: In [2]:timeit do_Mandelbrot_cython() 10 loops, best of 3: 53.8 ms per loop In [3]:timeit do_Mandelbrot_cython2() 10 loops, best of 3: 54 ms per loop This is after I put the underscore in the x_buffer declaration in do_Mandlebrot_cython2. As it was, with no u

Re: [Numpy-discussion] Surprising performance tweak in Cython

2008-06-22 Thread Gael Varoquaux
On Sun, Jun 22, 2008 at 05:02:38PM -1000, Eric Firing wrote: > The line above looks like a typo, and does not match your inline > version. Could that be making the difference? Thank you Eric! It was indeed a typo (the plot is nicer with the typo, surprising, but that also explains why it didn't

Re: [Numpy-discussion] Surprising performance tweak in Cython

2008-06-22 Thread Eric Firing
Gael Varoquaux wrote: > I tried tweak my Cython code for performance by manually inlining a small > function, and ended up with a less performant code. I must confess I > don't really understand what is going on here. If somebody has an > explaination, I'd be delighted. The code follows. > > +

[Numpy-discussion] Surprising performance tweak in Cython

2008-06-22 Thread Gael Varoquaux
I tried tweak my Cython code for performance by manually inlining a small function, and ended up with a less performant code. I must confess I don't really understand what is going on here. If somebody has an explaination, I'd be delighted. The code follows. +++