cbor-js icon indicating copy to clipboard operation
cbor-js copied to clipboard

Performance

Open paulirish opened this issue 9 years ago • 2 comments

Just to give folks an idea of perf of this lib, I ran a really simple benchmark with a ~200kb object.

image

Also I tried a similar test with node-cbor and got similar numbers: https://tonicdev.com/paulirish/56b25695414a7c0c0012b030

paulirish avatar Feb 03 '16 19:02 paulirish

That's to be expected - JSON.parse has browser native support. C++/text trumps javascript/binary.

richardstartin avatar Nov 13 '16 20:11 richardstartin

@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. cbortime

    console.time("cbor");
    geojson2 = CBOR.decode(data);
    console.timeEnd("cbor");
          console.time("geojson");
          geojson1 = JSON.parse(data);
          console.timeEnd("geojson");

sotex avatar Dec 11 '19 07:12 sotex