cbor-js
cbor-js copied to clipboard
Performance
Just to give folks an idea of perf of this lib, I ran a really simple benchmark with a ~200kb object.
Also I tried a similar test with node-cbor and got similar numbers: https://tonicdev.com/paulirish/56b25695414a7c0c0012b030
That's to be expected - JSON.parse has browser native support. C++/text trumps javascript/binary.
@paulirish @richardstartin I have the same situation. I use ajax to download the data and decode it. Test results show that JSON takes half as long as CBOR.
I think we can improve the performance of decoding CBOR through wasm.
console.time("cbor");
geojson2 = CBOR.decode(data);
console.timeEnd("cbor");
console.time("geojson");
geojson1 = JSON.parse(data);
console.timeEnd("geojson");