[Numpy-discussion] my cython is slow
Thu Jan 8 12:34:14 CST 2009
John Hunter wrote:
> On Wed, Jan 7, 2009 at 5:37 PM, Eric Firing <email@example.com> wrote:
>> A couple small changes speed it up quite a bit:
>> efiring@manini:~/temp/nnbf$ python test_nnbf.py
>> loading data... this could take a while
>> testing nnbf...
>> 10 trials: mean=0.0150, min=0.0100
>> testing numpy...
>> 10 trials: mean=0.0660, min=0.0600
>> It is all a matter of keeping Python objects and function calls out of inner
>> loops. I suspect there is quite a bit more that could be done in that
>> regard, but I haven't looked.
> Much faster, but no longer correct, as you'll see if you uncomment
> out the nose test test_neighbors that compare actual vs desired.
> Is the pointer arithmetic correct:
> dataptr + i
> I would have thought perhaps:
> dataptr + i*n
> but this is segfaulting. Do we need to use a stride?
Sorry, I was too hasty. Yes, it seems like i*n should be correct, but
it isn't; we are missing something simple and fundamental here. I don't
see it immediately, and won't be able to look at it for a while.
> Numpy-discussion mailing list
More information about the Numpy-discussion