Project

General

Profile

Feature #17685

Updated by mrkn (Kenta Murata) 6 months ago

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 
 ``` 
 


Back