From: dsisnero@... Date: 2021-03-16T23:48:54+00:00 Subject: [ruby-core:102890] [Ruby master Feature#17685] Marshal format for out of band buffer objects Issue #17685 has been updated by dsisnero (Dominic Sisneros). that is the case now. I am proposing changing Marshal to allow Marshal to load into an existing object for object identities. This is one of the things python's latest pickle format allows. They use it to marshal large numpy arrays to a distributed object store. See my original link. https://www.python.org/dev/peps/pep-0574/ ---------------------------------------- Feature #17685: Marshal format for out of band buffer objects https://bugs.ruby-lang.org/issues/17685#change-90951 * Author: dsisnero (Dominic Sisneros) * Status: Open * Priority: Normal ---------------------------------------- Allow the use of the marshal protocol to transmit large data (objects) from one process or ractor to another, on same machine or multiple machines without extra memory copies of the data. See Python PEP 574 - https://www.python.org/dev/peps/pep-0574/ Pickle protocol with out of band data. When marshalling memoryview objects, it would be nice to be able to use zero copy loads of the memoryviews. That way when loading the file we can use that memoryview without copying it also if desired. Add a Marshal::Buffer type in new version of Marshal to represent something that indicates a serializable no-copy buffer view. The marshal_dump must be able to represent references to a Marshal::Buffer to indicate that the loader might get the actual buffer out of band The marshal_load must be able to provide the Marshal::Buffer for deserialization Marshal load and dump should work normally if not used out of band. ```ruby class Apache::Arrow def marshal_dump(*) if marshal.version > '0.4' Marshal::Buffer.new(self) else #normal dump end end end ``` -- https://bugs.ruby-lang.org/ Unsubscribe: