News for hackers. Stuff that matters.
Re:Why We’re Switching to gRPC by denormalfloat on Monday May 27, 2019 @04:26PM (#20025034)
Is the JSON parser implemented natively, or in JS? It may not be apples-to-apples.
Re:Why We’re Switching to gRPC by scottlamb on Monday May 27, 2019 @06:13PM (#20025641)
> Is the JSON parser implemented natively, or in JS? It may not be apples-to-apples.

True, but if you're wanting an implementation you can use in Javascript running in the browser, it may accurately reflect reality. You have a high-quality browser-supplied (presumably native) implementation of JSON available. For a protobuf parser, you've just got Javascript. (You can call into webassembly, but given that afaik it can't produce Javascript objects on its own, it's not clear to me there's any advantage in doing so unless you're moving the calling code into webassembly also.)

I don't think browser-based parsing speed is important though. It's probably not a major contributor to display/interaction latency, energy use, or any other metric you care about. If it is, maybe you're wasting bandwidth by sending a bunch of data that's discarded immediately after parsing.

Re:Why We’re Switching to gRPC by fanf2 on Monday May 27, 2019 @05:18PM (#20025317)
My guess would be that most of the cost is creating the JS objects and the parsing is a relatively small part of the cost, so optimizing it would not help much.
Re:Why We’re Switching to gRPC by connor4312 on Monday May 27, 2019 @05:00PM (#20025218)
Yea, the V8 json parser is implemented naively and optimized alongside the engine in a way that other serialization methods in Javascript, and JSON in other languages, is generally not.