Live data from Hacker News

Cap’n Proto

capnproto.org

191–194 of 194 posts

Re: Cap’n Proto

#191

Earlier quoted context omitted.

You can certainly serialize to a byte array. The example uses a file descriptor but in fact the code defines an abstract stream type which you can implement any way you want, and you can also obtain pointers to the message's underlying storage in order to extract the bytes directly (avoiding a copy).

Great thanks. I'll give it a go again for a current project I'm kicking off.

i've had a look in kj/io.h

I see the classes: ArrayOutputStream/VectorOutputStream, i assumed these are the ones you are discussing.

Re: Cap’n Proto

#192

I think that compression is a must for the serialization library. Protobuf uses almost twice less memory than Cap'n Proto. Using an external compression is not an option in some cases. E.g. consider building tcp-server that communicates with thousands of clients simultaneously. Each client connection will have its own LZ4 context that should be heap allocated. I believe it's about 16KB per connection + buffers. This…

Cap'n Proto offers "packed" encoding which applies light compression (removing zero-valued padding bytes), brings it in-line with Protobuf, and ought to be much faster than the things Protobuf does for "compression" (varint is a very slow encoding!).

I'm glad that I was wrong about it.

Re: Cap’n Proto

#194

Earlier quoted context omitted.

Right, but you should be able to compile a library with either MinGW or clang from Linux that your users can use with MSVC.

Not if it uses C++. MinGW uses the G++ ABI which is totally incompatible with the MSVC ABI. (Also, a lot of the issues we face affect headers, which need to be compiled into the client projects.)

Since the code is so small and in C++ why not make it a header only library?
Post reply on HN