6 ms·
JSON is easier (faster) to parse on their client apps.
by elithrar 11y ago
JSON is easier (faster) to parse on their client apps.
- pquerna 11y agoIf you are building a new app, I'd really suggest checking out gRPC: http://www.grpc.io/ http://www.grpc.io/ The combination of an HTTP/2 stack w/ protocol buffers and libraries in everything you'd write a mobile app in is a powerful combo, and its a pretty high development velocity environment.
- elithrar 11y agogRPC is great, but Instagram's client apps are web-based (using React now), and consuming protobuf in JavaScript is unlikely to be faster (and definitely not as convenient) vs. JSON. Given the limited resources of a lot of Android devices, an extra unmarshalling step would offset any wire-size reductions.
- jsprogrammer 11y agoExtra unmarshaling? The string will either be parsed as JSON or some other thing.
- krashidov 11y agoJust to clarify, do you mean that all of their mobile apps are on react-native now? Or just their web apps?
- vkjv 11y agoJust finished a fairly large pilot test with grpc. Summary: it's not production ready. It seems to be still moving rapidly and bugs pop up. I'd recommend holding back for awhile longer. Also, instagram heavily relies on JS. There are not any protobuf parsers in js that perform anywhere near that of native json. The most feature complete implementation is two orders of magnitude slower. Using the C++ bindings is faster, but is more difficult to fit into a typical build, can't work in a browser, and still an order of magnitude slower. It's definitely something to keep an eye on, but, IMHO, not quite ready for something large scale.
- kristianp 11y agoHow does it compare to flatbuffers [1]? Facebook apparently uses it, but their usage is from java [2]. [1] https://google.github.io/flatbuffers/ https://google.github.io/flatbuffers/ [2] https://code.facebook.com/posts/872547912839369/improving-facebook-s-performance-on-android-with-flatbuffers/ https://code.facebook.com/posts/872547912839369/improving-fa...
- krschultz 11y agoHave you actually measured that? I've used a couple of different JSON libraries on Android and also some of the binary formats. In general the binary formats are more performant. I definitely agree with you that JSON is easier to work with, but at the scale of Instagram I don't think that would be an issue.