Closed aaronovz1 closed 6 years ago
I'm not an expert on the C++ port but are you saying you want the FBB to not write the image data into its owned buffer?
I guess I was trying to find a way to avoid the memcpy but I'm not really seeing how that would be possible. The only way I can achieve it in our setup is to the pull the image blob out of FB and send it separately as-is.
Generally FlatBuffers cannot refer to external data.
One thing you could try is:
data()
pointer of the vector.This avoids the memcpy, assuming ZeroMQ can pull its data from 2 buffers.
This is pretty much what I ended up doing. ZMQ has a concept of message parts, so I store the FB in one part, and the blob in a second part.
Is there a way to reduce allocations and copying of binary blobs by getting FlatBufferBuilder to use the binary data directly? In my use case I pull frames from a camera, serialize them with FB, and then broadcast over ZMQ. The problem I am facing is that the image data is being deep copied and this is hurting performance. I read that using CreateUninitializedVector plus memcpy is slightly better than using CreateVector but it's still not great.
The trimmed down sample of what I am doing currently:
Thanks