4 ms·
I was curious how this performed server-side versus protobufjs. (what we're currently using) I hastily wired it up to protobufjs's benchmark suite. (https://git
by mnutt 4y ago
I was curious how this performed server-side versus protobufjs. (what we're currently using) I hastily wired it up to protobufjs's benchmark suite. (https://github.com/protobufjs/protobuf.js/tree/master/bench https://github.com/protobufjs/protobuf.js/tree/master/bench) The suite is pretty ancient so getting buf-compiled esm added was a challenge.
Granted, the benchmark is created for protobufjs and they probably optimize against it. Protobuf-ES was about 5.1x slower than protobufjs for encoding and 14.8x slower than protobufjs for decoding.
This was run on my M1 with node 16.14; not particularly scientific, etc, etc.
- lowbloodsugar 4y agoProtobuf is really easy to write a working but slow version for.
- still_grokking 4y agoAny benchmarks against other PB implementations? Would love to see numbers against the JVM, and than against C++ or Rust. My gut feeling is anyway that PB in JS is likely a failure against just using JSON (which the JS runtime implements in efficient native code).
- mnutt 4y agoNo, but anecdotally the others are probably a lot faster. And you can do even better than that with zero-copy serializations. But protobuf has very wide support and is decent enough in js, at least server-to-server. Having a schema is very valuable, and there are substantial size wins over JSON, even with gzip.