Mark Zvilius Posted July 4, 2010 Report Share Posted July 4, 2010 I have a producer-consumer app that uses a queue. The data items are rather large matrixes .. on the order of 300kB. Because of the size of the matrixes, I've become interested in optimizing the number of data copies that are performed. I wrote some test code and simplified it down to the following, which uses a 10x10 matrix as the data item. I then used the "Show Buffer Allocations" tool to look at data copies (note the black dots on Initialize Array and Dequeue Element). Questions: 1. Is it really true that a copy is made on the Dequeue operation? That surprises me since there can be only one destination for the queue element. 2. Would I be able to eliminate the copy by wrapping the matrix in a DVR and passing the DVR on the queue? Would the performance hit of using the reference negate the savings? (I'm not sure if I would actually do this; it's more of an learning exercise at the moment.) I appreciate your input, Mark Zvilius Quote Link to comment
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.