(The following description was from Ken.)
This would be doable in theory if our message objects supported some mechanism for deferred serialization all the way down to the system layer. That could be an interesting idea to pursue, but I think typemapping leaves us in an awkward place.
A nice feature of typemaps is that they write directly from some source data into a message buffer. This means that even for non-movable objects, only a single minimal copy happens on send. If we used deferred serialization, we'd have to capture an intermediate copy of these objects at send-time anyway, much like Bind does.
Of course if this were combined with scatter-gather I/O, we could just always serialize non-movable types into their own buffer right away and thus get the best of both worlds, paying serialization cost for only these types in the intraprocess case. Alternatively we could just generate code to do full upfront serialization for any message with an argument that's neither movable nor trivially copyable.
In any case, while deferred serialization would make the low-level message object API just that much more awkward to use, it wouldn't require a very complex implementation.
Comment 1 by roc...@chromium.org
, Oct 17