Closed gabrieldodan closed 8 years ago
It's not quite correct to compare JSON and Protocol Buffers. Also, you should run serialization/parsing more than 1 time to measure performance and use high-resolution timers instead of DateTime. And I highly doubt 100000 fields array is a real-life example.
It is slower even with small arrays, 100 fields array for example. With what should we compare if not with JSON ?
Apache Thrift for example. JSON is native to JS and V8, so it's obviously fast. Also it's much simpler format that protobuf. There really is no point in using protobuf over JSON if your app is Node.js-only. This addon is meant to be used to communicate with existing non-JS apps.
This module https://github.com/chrisdew/protobuf runs faster. It should be comparable to JSON in my opinion, both are C/C++ code. Also if you make a test on a .proto file like this
message Points {
repeated fixed32 i = 1;
repeated fixed32 j = 2;
}
the performance is much much better than JSON!
It should be comparable to JSON in my opinion, both are C/C++ code
Nope, see https://code.google.com/p/v8/source/browse/trunk/src/json.js
I've got some ideas on how to improve performance.
Hi, is it normal to run slower than JSON or I am doing something wrong ?
.proto file
Node version 0.10.29 on Linux. JSON runs two times faster than proto buf !