News for hackers. Stuff that matters.
Re:MessagePack: like JSON, but fast and small by dddbbb on Tuesday March 10, 2020 @01:49PM (#22537673)
Why would you make a comparison by gzipping one and not the other? Running gzip on the msgpack example reduced it from 304 to 248 bytes.
Re:MessagePack: like JSON, but fast and small by dwild on Tuesday March 10, 2020 @03:54PM (#22538971)
Sure, but I think what he meant is that what the website is showing isn't the real gains.

Without GZIP:

JSON 583 bytes

MessagePack 304 bytes

52 %

With GZIP:

JSON (GZIP) 289 bytes

MessagePack (GZIP) 248 bytes

85%

Re:MessagePack: like JSON, but fast and small by giantrobot on Tuesday March 10, 2020 @06:28PM (#22540533)
So MessagePack lets you skip the CPU and memory usage needed to compress the JSON yet get similarly sized messages to compression JSON. The compression of the JSON Is a non-trivial extra load on a busy server.
Re:MessagePack: like JSON, but fast and small by dwild on Wednesday March 11, 2020 @10:22AM (#22546052)
Most likely you'll have GZIP enabled on all your HTTP request. Your bandwidth will be a bottleneck way before GZIP CPU load become one.

I just took a quick look and they do compress their queries, using Brotli, which is even more efficient than GZIP. They are behind Cloudflare, so it's probably from them.

I just tried with https://jsonplaceholder.typicode.com/todos and I get this:

Raw:

JSON: 24,311

MessagePack: 14,704

60 %

With GZIP:

JSON: 3,965

MessagePack: 4,063

102%

With Brotli:

JSON: 3,495

MessagePack: 3,704

106%

So essentially, MessagePack compressed is WORSE than JSON, and not compressed, is at least 3 times worse than compressed.

Re:MessagePack: like JSON, but fast and small by giantrobot on Wednesday March 11, 2020 @07:10PM (#22551798)
So you're saying MessagePack with no compression is way smaller than JSON. Which means with no load for compression it has a 40% bandwidth savings. With compression it's negligibly worse than compressed JSON. Seems like a back foot argument for MessagePack over JSON. That's to say nothing of the encode/decode efficiency differences.

In the case where your data can't be cached but CloudFlare proxies and compresses for you, MessagePack wins because your uncompressed connection to CF is 40% more bandwidth efficient so egress out of your app server for any traffic is reduced. In the case where CF can cache responses you get the same back end bandwidth win for a negligible (if any actual) amount of extra egress out of CF.

Use what you want but if you need a schemaless serialization format, MessagePack works well and is compact for "free".

Re:MessagePack: like JSON, but fast and small by kragen on Thursday March 12, 2020 @11:58AM (#22558141)
A different way of looking at this is that MessagePack is a worse way to compress JSON than gzip or Brotli, at least under some circumstances.
Re:MessagePack: like JSON, but fast and small by imtringued on Tuesday March 10, 2020 @08:13PM (#22541516)
Or you just use JSON with gzip and never think about this problem ever again. Choosing msgpack vs JSON is a micro optimization at this point. There are significantly better alternatives if you want to save CPU cycles.