2 ms·
This will tend to depend on the details of the language. In Java, there is java.nio.ByteBuffer which (I think) can basically do everything that is done with po
by kentonv 14y ago
This will tend to depend on the details of the language.
In Java, there is java.nio.ByteBuffer which (I think) can basically do everything that is done with pointer arithmetic in the C++ implementation.
In, say, Python, it may make more sense to decode the message to Py objects upfront. You could use Python's struct packing library to do this fairly efficiently, and you could lazily decode sub-objects. If you are using Python, you probably aren't going for blazing speed anyway.
Another possibility in many languages is to write bindings that call into C++, though that obviously has a bunch of trade-offs.
Finally, if you're communicating with browser-side Javascript, you probably just want to transcode the object to/from JSON on the server side. I intend to provide libraries that make that easy.