3 ms·
If I'm reading the PEP correctly, it's possible to send memoryview buffers through channels without copying the underlying data. The few other types supported
by duckerude 7y ago
If I'm reading the PEP correctly, it's possible to send memoryview buffers through channels without copying the underlying data.
The few other types supported by channels (None, bytes, str, int) are all immutable, so I would guess that those are also shared without copying.
- pdonis 7y agoYes, these particular types of data can be shared (as you say, sharing immutable objects obviously doesn't require copying since they're immutable); but I took "shared data" to mean being able to share arbitrary objects, since that's the sense of "sharing" that is relevant when we're talking about various forms of concurrency. If all I can share between concurrent computations is those limited data types, then I have to pickle/marshal everything else, which is effectively the same thing I have to do with multiple processes.
- duckerude 7y agoI see. I was paraphrasing from the article originally, and didn't mean "share data" in a very general way. Sharing memoryviews lets you share e.g. numpy arrays, so it should be powerful enough for some applications.