4 ms·
It's the serialization/deserialization that gets you. And not just the actual transformation, but also the fact that you have to turn every operation into some
by rabidrat 8y ago
It's the serialization/deserialization that gets you. And not just the actual transformation, but also the fact that you have to turn every operation into some message. What could be a fast loop to read/modify/write the bytes in some rectangle in video memory, now has to read all those bytes into a flat buffer, do the modify (probably with extra code because the layout of the mask and the layout of the buffer are no longer compatible), send through the kernel, and then get unpacked and written to video memory in the other process. For infrequent or batch jobs this might be a well-structured interface with some good robustness features. For user interfaces which should be low latency it takes 10-100x as long and for no actual benefit.
Also doing things in big chunks is more efficient, but usually adds latency.