top | item 44005006

(no title)

ogrisel | 9 months ago

You cannot share arbitrarily structured objects in the `ShareableList`, only atomic scalars and bytes / strings.

If you want to share structured Python objects between instances, you have to pay the cost of `pickle.dump/pickle.dump` (CPU overhead for interprocess communication) + the memory cost of replicated objects in the processes.

discuss

order

notpushkin|9 months ago

We need a dataclass-like interface on top of a ShareableList.

tomrod|9 months ago

I can fit a lot of json into bytes/strings though?

frollogaston|9 months ago

If all your state is already json-serializable, yeah. But that's just as expensive as copying if not more, hence what cjbgkagh said about flatbuffers.

cjbgkagh|9 months ago

Perhaps flatbuffers would be better?

reliabilityguy|9 months ago

What’s the point? The whole idea is to share an object, and not to serialize them whether it’s json, pickle, or whatever.

vlovich123|9 months ago

That’s even worse than pickle.

sgarland|9 months ago

So don’t do that? Send data to workers as primitives, and have a separate process that reads the results and serializes it into whatever form you want.