[Numpy-discussion] Speeding up wxPython/numarray

Francesc Alted falted at pytables.org
Thu Jul 1 01:51:39 CDT 2004


A Dimecres 30 Juny 2004 23:47, Todd Miller va escriure:
> > There were a couple of other things I tried that resulted in additional 
> > small speedups, but the tactics I used were too horrible to reproduce 
> > here. The main one of interest is that all of the calls to 
> > NA_updateDataPtr seem to burn some time. However, I don't have any idea 
> > what one could do about that.
> 
> Francesc Alted had the same comment about NA_updateDataPtr a while ago.
> I tried to optimize it then but didn't get anywhere.  NA_updateDataPtr()
> should be called at most once per extension function (more is
> unnecessary but not harmful) but needs to be called at least once as a
> consequence of the way the buffer protocol doesn't give locked
> pointers.  

FYI I'm still refusing to call NA_updateDataPtr() in a spoecific part of my
code that requires as much speed as possible. It works just fine from
numarray 0.5 on (numarray 0.4 gave a segmentation fault on that). However,
Todd already warned me about that and told me that this is unsafe.
Nevertheless, I'm using the optimization for read-only purposes (i.e. they
are not accessible to users) over numarray objects, and that *seems* to be
safe (at least I did not have any single problem after numarray 0.5). I know
that I'm walking on the cutting edge, but life is dangerous anyway ;).

By the way, that optimization gives me a 70% of improvement during element
access to NumArray elements. It would be very nice if you finally can
achieve additional performance with your recent bet :).

Good luck!,

-- 
Francesc Alted





More information about the Numpy-discussion mailing list