Live data from Hacker News

You're Using JSON, Why not MessagePack?

blog.andrewvc.com

61–66 of 66 posts

Re: You're Using JSON, Why not MessagePack?

#61

Earlier quoted context omitted.

That mostly speaks to the quality of node's MessagePack implementation, nothing more. Benchmarking data format serialization is hard, because one poor implementation throws things off.

MessagePack in Node isn't much more than bindings to the C++ library ( https://github.com/pgriess/node-msgpack/blob/master/src/msgp... ). For me the bottom line was "What's faster in Node, for my project, right now?", and the answer was JSON. There are benefits to MessagePack that have already been mentioned here, namely not having to base64 binary data first (smaller size), but that's true for any binary message for…

True, but, optimization is tricky, and you can say the say thing about ruby's messagepack and JSON libraries, where the speed difference is reversed. I, unfortunately don't have the time to go digging as to why, but there's a discrepancy somewhere.

Re: You're Using JSON, Why not MessagePack?

#62
post #7

There's also TNetStrings which mongrel2 is using now. ( http://tnetstrings.org/ )

Which is itself really just a flawed reimplementation of bencode. (Bencode can be parsed without lookahead; tagged netstrings cannot.)

http://wiki.theory.org/BitTorrentSpecification#bencoding

Re: You're Using JSON, Why not MessagePack?

#63

* fucking use JSON * if needed: use snappy for blob storage (ie for key value stores) * if you have an need for very high perfomance in your application that is mature to some degree, evaluate some binary protocols or compression and see how they perform. the bad thing is that i already see full stack frameworks popping up "now with " and everybody will scream "YEAH!". Most YEAH!-sayers will seriously be butt-hurt by…

Your tone in really just not constructive and also not appreciated.

As far as JSON being human readable, most JSON sent over the wire has no whitespace and generally needs to be run through a parser if you're going to read any significant amount if it.

You even say in your third point that if you need high performance you'd look at a binary protocol, this is one such protocol. Also, you completely ignore the space savings mentioned.

Your name is green, you're new to HN, and frankly comments like this drive away the kind of users we want here, so learn to talk to your peers respectfully, or keep your mouth shut.

Re: You're Using JSON, Why not MessagePack?

#64

* fucking use JSON * if needed: use snappy for blob storage (ie for key value stores) * if you have an need for very high perfomance in your application that is mature to some degree, evaluate some binary protocols or compression and see how they perform. the bad thing is that i already see full stack frameworks popping up "now with " and everybody will scream "YEAH!". Most YEAH!-sayers will seriously be butt-hurt by…

Your tone in really just not constructive and also not appreciated. As far as JSON being human readable, most JSON sent over the wire has no whitespace and generally needs to be run through a parser if you're going to read any significant amount if it. You even say in your third point that if you need high performance you'd look at a binary protocol, this is one such protocol. Also, you completely ignore the space sa…

What i am saying is that as long you try to "improve" your project with marginal "improvements" you will fail at anything. For the majority, things like message pack is micromanagement. It will cause a lot of work and noise with minor improvements. The tradeoff is too high, for the majority. The minority are people who already have shit done. That are people who are actually saving alot of money with squezing the last bits of performance out of something. my viewpoint is probably out of scope because its wholistic, but thats where to start.

Re: You're Using JSON, Why not MessagePack?

#65
post #7

There's also TNetStrings which mongrel2 is using now. ( http://tnetstrings.org/ )

Which is itself really just a flawed reimplementation of bencode. (Bencode can be parsed without lookahead; tagged netstrings cannot.) http://wiki.theory.org/BitTorrentSpecification#bencoding

It's actually an extension of DJB's netstrings. Hence the name.

Re: You're Using JSON, Why not MessagePack?

#66
If you are representing this on an HTML page you'd need to Base64 encode the bugger, adding a lot more overhead.

Honestly I'm not sure why you wouldn't just simply use gzipped/JSON. My test show nearly no difference (1-2%) in performance with MessagePack, yet you get to leverage all kinds of things that already understand JSON.

Post reply on HN