Matthew, 07.01.2010 23:04:
> It would be nice if I could profile on a line by line basis.  I'm not
> sure if the python cProfile tool supports this or not.

You can always extract some interesting sections to an inline function.


> Though I probably need to do some more debugging to see if I have a lot
> of cache misses,or some bug in my logic.

Yes, I'd certainly investigate that first. Try to find out if the caching 
works as expected.


> For the life of me I could not figure out how to just put the matrix
> object itself into my hash indexed memory cache. It seemed like my python
> objects were always being garbage collected once I hit the __dealloc__
> routine (the self.arr ndarray as an example).

__dealloc__ is part of the deallocation process, i.e. it is already clear 
at the point of calling it that the object is no longer referenced and can 
be discarded. Also, at least during a garbage collector run, the Python 
attributes of the object will already have been cleared before calling 
__dealloc__, so you can't use them anymore. Only C type attributes are safe 
to access here. Read the Cython and CPython docs for that.


> Later I found out that the
> cython class get's stripped of it's attributes if it's stored in a
> dictionary.

Certainly not, but you didn't show us your hashing code, so I can't give a 
better comment on why you might think this is the case.

Stefan

_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to