Binary protocols #767
Replies: 2 comments 4 replies
-
Everything you need to encode and decode binary with JavaScript is already in Node Buffer and browser DataView, you could add a couple helper functions which I did here https://github.com/e3dio/packBytes if you want to really pack in data small, example is 50x smaller than JSON and 10x faster to encode, also I helped a guy do his specific case here e3dio/packBytes#5 (reply in thread) if you want to see a full encode and decode in a somewhat advanced example for some GeoJson data. Would be interesting to compare the native SBE with the equivalent encode in JS and see what the performance difference is, but the JS seems to be fast enough |
Beta Was this translation helpful? Give feedback.
-
I'm repulsed by JSON and such protocols but then again I am not a web developer so I will never understand. Yes, JSON + zlib will produce pretty much the same size as a good binary protocol, but comparing the CPU and memory overhead between JSON + compression and just simply learning to directly put your data in an efficient format from the start is MASSIVE in many cases. A schema-based binary protocol like Protobuf is awesome and you get static types and static names, so you cannot have typo bugs (which you ALWAYS get when developing with JSON, since everything is dynamic and string-matched). Honestly, JSON protocols are a sign of mental problems. But that's my take, and my take is not very popular. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Just read the docs, great writeup. Communicating with json instead of wrapping some binary protocol impl in some accessible interfaces to the developer seems to be criminal indeed. You mention there protobufs, but I remember spending some time pondering on real logics aeron and simple binary encoding. Soo, what's your thoughts on that and did you think about bringin some of that, speaking here about utt probably, into uws ecosystem?
Beta Was this translation helpful? Give feedback.
All reactions