On 6/26/08, Robert Bradshaw <[EMAIL PROTECTED]> wrote: > On Jun 26, 2008, at 5:03 PM, Jay Parlar wrote: > > We're putting data into the queue 1000 times per second, so that needs > > to be fast. And we're pulling data back out a few times per second, > > but pulling out large chunks, so that too needs to be fast. This is > > essentially the core stuff happening in the tight while loop of our > > program. > > > If the producer/consumer of the data is in Python, you are better off > (I believe) storing them tuples of floats in a Python list than > trying to wrap/unwrap them. To see significant speedups you would > probably have to to write the code that pushes/pulls data from the > queue to process and produce native C doubles, and interact with the > queue using cdef functions. Having a fast queue isn't going to gain > you much if the inner loop is pushing/pulling via Python objects via > Python functions.
Well, with a little rework, I can make the producer stay in C the entire time. Every once in awhile, the consumer needs to pull the data out and pass it off to wxPython though, so the end result definitely has to be Python data. However, the consumer is only running a handful of times per second. So maybe that's what I'll do. Keep the entire producer in Pyrex, and the only access that Python will have to it is through the get() method. That way, I only have to convert *to* Python objects, and not from. Jay P. _______________________________________________ Cython-dev mailing list [email protected] http://codespeak.net/mailman/listinfo/cython-dev
