Hacker News new | ask | show | jobs
by dwmbt 1321 days ago
My own search results:

[0] https://github.com/boguslaw-wojcik/encoding-benchmarks [1] https://github.com/alecthomas/go_serialization_benchmarks [2] https://techsparx.com/nodejs/datastore/protocol-buffers.html

1 comments

First two links are Go, so not relevant to client-side.

Third link is also server-side, but since it's NodeJS it's at least close enough / more relevant to client-side perf.

Here's the benchmark from the third link:

    benchmark        time (avg)             (min … max)
    ---------------------------------------------------
    encode-JSON  342.37 µs/iter   (311.93 µs … 1.19 ms)
    decode-JSON   435.9 µs/iter   (384.44 µs … 1.41 ms)
    encode-PB    946.43 µs/iter   (777.38 µs … 3.13 ms)
    decode-PB    770.79 µs/iter   (688.99 µs … 1.78 ms)
    encode-PBJS  696.75 µs/iter   (618.43 µs … 2.43 ms)
    decode-PBJS  455.36 µs/iter   (413.66 µs … 1.09 ms)

showing JSON to be significantly faster
ahh yea, i'm not sure why the rest of my comment didn't upload. i was going to say that i thought the common use case for protobufs was to more ergonomically communicate between microservices?

in any case, that's the only time i've ever seen it used in production. the first link is a go benchmark that i felt represented why someone would use it for those purposes, the second was linked to show that despite numerous (successful!) attempts to make deserializing/serializing data faster and smaller, JSON is still the most heavily used and i would wager it's mostly due to how easy it is to use as far as browsers are concerned. the third was a link to justify that claim and show that js-land is much, much different than go-land as far as proto's and JSON encoding/decoding are concerned!