I need to create a fast hashing function to cache the creation and deletion of an extension class that uses an external C buffer. (It's actually a buffer on a hardware device.)
I can't afford to keep creating and deleting these items so I want to save them all off and reuse them as needed. So I thought it would be easy just to create an array of python objects and use a simple hash into an array written in cython and maybe a little C. I was wrong. A buffer of the type cdef object[int] myhash can only be declared locally inside some function or method. I don't see any suitable python class. The closest would be set, but this needs to be minimalistic and as fast as possible. Set is just too heavy and probably slow for my needs. In fact it would be nice if I could override the creation and destruction of my extension classes so that the class and it's python attribute objects don't get garbage collected. My best hope was storing it in some kind of python aware cython array, but I'm not sure this will work. If I store objects in C arrays somehow, then the objects will get garbage collected anyway. It seems to be a bit of a conundrum. Any thoughts? _______________________________________________ Cython-dev mailing list [email protected] http://codespeak.net/mailman/listinfo/cython-dev
