traversc / qs

Quick serialization of R objects
397 stars 19 forks source link

Documentation and examples, especially for qsave_ptr #83

Closed angel-bee2018 closed 1 year ago

angel-bee2018 commented 1 year ago

Hi,

I've been trying to find a quicker way of serialising objects for transfer between R processes without saving to file, and I happened to stumble upon qsave_ptr and qsave_fd which seem to be the right tools for the job (??). Unfortunately, my understanding of low level stuff like file descriptors, memory pointers and addresses is limited, so would it be possible to include more documentation and examples as to how this and other qs:: functions may be applied to inter-process object transfer? And if applicable, maybe examples of where one can qs serialise over socket connections, that would be much, much needed and appreciated

cheers

traversc commented 1 year ago

Hi,

qsave_ptr wouldn't be of help, it references intra-process pointers.

qsave_fd may be able to help. If you use linux, you could use pipes and experiment with it.

Another approach would be to qserialize and use base R's socket connection functions.

You are right that qs doesn't have explicit inter-process support. It'd be helpful if you could give an example usage. I'll leave this open in case anyone has ideas on how to do this best.