Closed sitegui closed 7 years ago
If we pre allocate the right amount (51KiB) to avoid relocs, the speed boost is very considerable:
JSON
Time: 1.948ms
Size: 190KiB
js-binary
Time: 1.989ms (2%)
Size: 51KiB (3.7x less)
As of node v8.9.0, the results are even better:
Encode
JSON
Time: 2.47ms
Size: 190KiB
js-binary
Time: 1.453ms (-41%)
Size: 51KiB (3.7x less)
Decode
JSON
Time: 2.791ms
js-binary
Time: 0.497ms (-82%)
I've just run the same benchmark against native JSON implementation that was created back in the days of node 0.10, but this time against node 0.12
js-binary's decoding wins big: 0.462ms vs 2.829ms (-84%) but the encoding is now slower: 1.989ms vs 2.198ms (11%)
This is an issue to track some improvements in encoding time